1
0
mirror of https://github.com/immich-app/immich.git synced 2025-07-13 07:00:55 +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:
Jason Rasmussen
2024-02-13 17:07:37 -05:00
committed by GitHub
parent 9b4a770b9d
commit 8fd94211c0
66 changed files with 593 additions and 850 deletions

View File

@ -1,16 +1,15 @@
<script lang="ts">
import { api, type UserResponseDto } from '@api';
import { createEventDispatcher } from 'svelte';
import { notificationController, NotificationType } from '../shared-components/notification/notification';
import Button from '../elements/buttons/button.svelte';
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
import Icon from '$lib/components/elements/icon.svelte';
import { mdiAccountEditOutline, mdiClose } from '@mdi/js';
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
import { AppRoute } from '$lib/constants';
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
import { handleError } from '$lib/utils/handle-error';
import { convertFromBytes, convertToBytes } from '$lib/utils/byte-converter';
import { serverInfo } from '$lib/stores/server-info.store';
import { convertFromBytes, convertToBytes } from '$lib/utils/byte-converter';
import { handleError } from '$lib/utils/handle-error';
import { updateUser, type UserResponseDto } from '@immich/sdk';
import { mdiAccountEditOutline, mdiClose } from '@mdi/js';
import { createEventDispatcher } from 'svelte';
import Button from '../elements/buttons/button.svelte';
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
export let user: UserResponseDto;
export let canResetPassword = true;
@ -36,7 +35,7 @@
const editUser = async () => {
try {
const { id, email, name, storageLabel, externalPath } = user;
const { status } = await api.userApi.updateUser({
await updateUser({
updateUserDto: {
id,
email,
@ -47,9 +46,7 @@
},
});
if (status === 200) {
dispatch('editSuccess');
}
dispatch('editSuccess');
} catch (error) {
handleError(error, 'Unable to update user');
}
@ -59,7 +56,7 @@
try {
const defaultPassword = 'password';
const { status } = await api.userApi.updateUser({
await updateUser({
updateUserDto: {
id: user.id,
password: defaultPassword,
@ -67,15 +64,9 @@
},
});
if (status == 200) {
dispatch('resetPasswordSuccess');
}
dispatch('resetPasswordSuccess');
} catch (error) {
console.error('Error reseting user password', error);
notificationController.show({
message: 'Error reseting user password, check console for more details',
type: NotificationType.Error,
});
handleError(error, 'Unable to reset password');
} finally {
isShowResetPasswordConfirmation = false;
}