mirror of
https://github.com/immich-app/immich.git
synced 2026-03-09 19:57:41 +03:00
chore(web): generate API functions with a single argument (#2568)
This commit is contained in:
@@ -10,7 +10,7 @@ export const load = (async ({ params, locals: { api, user } }) => {
|
||||
const albumId = params['albumId'];
|
||||
|
||||
try {
|
||||
const { data: album } = await api.albumApi.getAlbumInfo(albumId);
|
||||
const { data: album } = await api.albumApi.getAlbumInfo({ id: albumId });
|
||||
return {
|
||||
album,
|
||||
meta: {
|
||||
|
||||
@@ -90,7 +90,7 @@ describe('Albums BLoC', () => {
|
||||
const newAlbum = await sut.createAlbum();
|
||||
|
||||
expect(apiMock.albumApi.createAlbum).toHaveBeenCalledTimes(1);
|
||||
expect(apiMock.albumApi.createAlbum).toHaveBeenCalledWith(payload);
|
||||
expect(apiMock.albumApi.createAlbum).toHaveBeenCalledWith({ createAlbumDto: payload });
|
||||
expect(newAlbum).toEqual(returnedAlbum);
|
||||
});
|
||||
|
||||
@@ -130,7 +130,7 @@ describe('Albums BLoC', () => {
|
||||
const updatedAlbums = get(sut.albums);
|
||||
|
||||
expect(apiMock.albumApi.deleteAlbum).toHaveBeenCalledTimes(1);
|
||||
expect(apiMock.albumApi.deleteAlbum).toHaveBeenCalledWith(albumToDeleteId);
|
||||
expect(apiMock.albumApi.deleteAlbum).toHaveBeenCalledWith({ id: albumToDeleteId });
|
||||
expect(updatedAlbums).toHaveLength(4);
|
||||
expect(updatedAlbums).not.toContain(albumToDelete);
|
||||
expect(get(sut.isShowContextMenu)).toBe(false);
|
||||
|
||||
@@ -40,7 +40,9 @@ export const useAlbums = (props: AlbumsProps) => {
|
||||
async function createAlbum(): Promise<AlbumResponseDto | undefined> {
|
||||
try {
|
||||
const { data: newAlbum } = await api.albumApi.createAlbum({
|
||||
albumName: 'Untitled'
|
||||
createAlbumDto: {
|
||||
albumName: 'Untitled'
|
||||
}
|
||||
});
|
||||
|
||||
return newAlbum;
|
||||
@@ -53,7 +55,7 @@ export const useAlbums = (props: AlbumsProps) => {
|
||||
}
|
||||
|
||||
async function deleteAlbum(album: AlbumResponseDto): Promise<void> {
|
||||
await api.albumApi.deleteAlbum(album.id);
|
||||
await api.albumApi.deleteAlbum({ id: album.id });
|
||||
}
|
||||
|
||||
async function showAlbumContextMenu(
|
||||
@@ -83,7 +85,7 @@ export const useAlbums = (props: AlbumsProps) => {
|
||||
)
|
||||
) {
|
||||
try {
|
||||
await api.albumApi.deleteAlbum(albumToDelete.id);
|
||||
await api.albumApi.deleteAlbum({ id: albumToDelete.id });
|
||||
const _albums = get(albums);
|
||||
albums.set(_albums.filter((a) => a.id !== albumToDelete.id));
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user