mirror of
https://github.com/immich-app/immich.git
synced 2026-04-19 17:08:48 -04:00
19 lines
653 B
TypeScript
19 lines
653 B
TypeScript
import { eventManager } from '$lib/managers/event-manager.svelte';
|
|
import { handleError } from '$lib/utils/handle-error';
|
|
import { getFormatter } from '$lib/utils/i18n';
|
|
import { resetPinCode, type PinCodeResetDto } from '@immich/sdk';
|
|
import { toastManager } from '@immich/ui';
|
|
|
|
export const handleResetPinCode = async (dto: PinCodeResetDto) => {
|
|
const $t = await getFormatter();
|
|
|
|
try {
|
|
await resetPinCode({ pinCodeResetDto: dto });
|
|
toastManager.success($t('pin_code_reset_successfully'));
|
|
eventManager.emit('UserPinCodeReset');
|
|
return true;
|
|
} catch (error) {
|
|
handleError(error, $t('errors.failed_to_reset_pin_code'));
|
|
}
|
|
};
|