mirror of
https://github.com/immich-app/immich.git
synced 2025-07-03 21:40:00 +02:00
refactor(web): use new open api client (#7097)
* refactor(web): use new open api client * refactor: remove activity api * refactor: trash, oauth, and partner apis * refactor: job api * refactor: face, library, system config * refactor: user api * refactor: album api
This commit is contained in:
parent
9b4a770b9d
commit
8fd94211c0
66 changed files with 593 additions and 850 deletions
web/src/lib/utils
|
@ -1,34 +1,33 @@
|
|||
import { notificationController, NotificationType } from '$lib/components/shared-components/notification/notification';
|
||||
import { downloadManager } from '$lib/stores/download';
|
||||
import { api } from '@api';
|
||||
import {
|
||||
api,
|
||||
type BulkIdResponseDto,
|
||||
addAssetsToAlbum as addAssets,
|
||||
type AssetResponseDto,
|
||||
type DownloadResponseDto,
|
||||
type AssetTypeEnum,
|
||||
type BulkIdResponseDto,
|
||||
type DownloadInfoDto,
|
||||
AssetTypeEnum,
|
||||
type DownloadResponseDto,
|
||||
type UserResponseDto,
|
||||
} from '@api';
|
||||
import { handleError } from './handle-error';
|
||||
} from '@immich/sdk';
|
||||
import { DateTime } from 'luxon';
|
||||
import { handleError } from './handle-error';
|
||||
|
||||
export const addAssetsToAlbum = async (albumId: string, assetIds: Array<string>): Promise<BulkIdResponseDto[]> =>
|
||||
api.albumApi
|
||||
.addAssetsToAlbum({
|
||||
id: albumId,
|
||||
bulkIdsDto: { ids: assetIds },
|
||||
key: api.getKey(),
|
||||
})
|
||||
.then(({ data: results }) => {
|
||||
const count = results.filter(({ success }) => success).length;
|
||||
notificationController.show({
|
||||
type: NotificationType.Info,
|
||||
message: `Added ${count} asset${count === 1 ? '' : 's'}`,
|
||||
});
|
||||
|
||||
return results;
|
||||
addAssets({
|
||||
id: albumId,
|
||||
bulkIdsDto: { ids: assetIds },
|
||||
key: api.getKey(),
|
||||
}).then((results) => {
|
||||
const count = results.filter(({ success }) => success).length;
|
||||
notificationController.show({
|
||||
type: NotificationType.Info,
|
||||
message: `Added ${count} asset${count === 1 ? '' : 's'}`,
|
||||
});
|
||||
|
||||
return results;
|
||||
});
|
||||
|
||||
export const downloadBlob = (data: Blob, filename: string) => {
|
||||
const url = URL.createObjectURL(data);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue