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:
Jason Rasmussen 2024-02-13 17:07:37 -05:00 committed by GitHub
parent 9b4a770b9d
commit 8fd94211c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
66 changed files with 593 additions and 850 deletions

View file

@ -6,11 +6,12 @@
NotificationType,
notificationController,
} from '$lib/components/shared-components/notification/notification';
import { AppRoute } from '$lib/constants';
import { addAssetsToAlbum } from '$lib/utils/asset-utils';
import { type AlbumResponseDto, api } from '@api';
import { type AlbumResponseDto } from '@api';
import { createAlbum } from '@immich/sdk';
import { getMenuContext } from '../asset-select-context-menu.svelte';
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
import { AppRoute } from '$lib/constants';
export let shared = false;
let showAlbumPicker = false;
@ -27,8 +28,8 @@
showAlbumPicker = false;
const assetIds = [...getAssets()].map((asset) => asset.id);
api.albumApi.createAlbum({ createAlbumDto: { albumName, assetIds } }).then((response) => {
const { id, albumName } = response.data;
createAlbum({ createAlbumDto: { albumName, assetIds } }).then((response) => {
const { id, albumName } = response;
notificationController.show({
message: `Added ${assetIds.length} to ${albumName}`,

View file

@ -5,10 +5,10 @@
NotificationType,
notificationController,
} from '$lib/components/shared-components/notification/notification';
import { type AlbumResponseDto, api } from '@api';
import { getAlbumInfo, removeAssetFromAlbum, type AlbumResponseDto } from '@immich/sdk';
import { mdiDeleteOutline } from '@mdi/js';
import MenuOption from '../../shared-components/context-menu/menu-option.svelte';
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
import { mdiDeleteOutline } from '@mdi/js';
export let album: AlbumResponseDto;
export let onRemove: ((assetIds: string[]) => void) | undefined;
@ -21,13 +21,12 @@
const removeFromAlbum = async () => {
try {
const ids = [...getAssets()].map((a) => a.id);
const { data: results } = await api.albumApi.removeAssetFromAlbum({
const results = await removeAssetFromAlbum({
id: album.id,
bulkIdsDto: { ids },
});
const { data } = await api.albumApi.getAlbumInfo({ id: album.id });
album = data;
album = await getAlbumInfo({ id: album.id });
onRemove?.(ids);

View file

@ -1,15 +1,15 @@
<script lang="ts">
import Icon from '$lib/components/elements/icon.svelte';
import {
NotificationType,
notificationController,
} from '$lib/components/shared-components/notification/notification';
import type { OnRestore } from '$lib/utils/actions';
import { handleError } from '$lib/utils/handle-error';
import { api } from '@api';
import Icon from '$lib/components/elements/icon.svelte';
import { restoreAssets } from '@immich/sdk';
import { mdiHistory } from '@mdi/js';
import Button from '../../elements/buttons/button.svelte';
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
import { mdiHistory } from '@mdi/js';
import type { OnRestore } from '$lib/utils/actions';
export let onRestore: OnRestore | undefined;
@ -22,7 +22,7 @@
try {
const ids = [...getAssets()].map((a) => a.id);
await api.trashApi.restoreAssets({ bulkIdsDto: { ids } });
await restoreAssets({ bulkIdsDto: { ids } });
onRestore?.(ids);
notificationController.show({