chore: migrate away from event dispatcher (#12820)

This commit is contained in:
Daniel Dietzler 2024-09-20 23:02:58 +02:00 committed by GitHub
parent 529d49471f
commit 124eb8251b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
72 changed files with 360 additions and 656 deletions

View file

@ -5,7 +5,6 @@
import { handleError } from '$lib/utils/handle-error';
import { updateUserAdmin, type UserAdminResponseDto } from '@immich/sdk';
import { mdiAccountEditOutline } from '@mdi/js';
import { createEventDispatcher } from 'svelte';
import Button from '../elements/buttons/button.svelte';
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
import { t } from 'svelte-i18n';
@ -15,6 +14,8 @@
export let canResetPassword = true;
export let newPassword: string;
export let onClose: () => void;
export let onResetPasswordSuccess: () => void;
export let onEditSuccess: () => void;
let error: string;
let success: string;
@ -27,12 +28,6 @@
!!quotaSize &&
convertToBytes(Number(quotaSize), ByteUnit.GiB) > $serverInfo.diskSizeRaw;
const dispatch = createEventDispatcher<{
close: void;
resetPasswordSuccess: void;
editSuccess: void;
}>();
const editUser = async () => {
try {
const { id, email, name, storageLabel } = user;
@ -46,7 +41,7 @@
},
});
dispatch('editSuccess');
onEditSuccess();
} catch (error) {
handleError(error, $t('errors.unable_to_update_user'));
}
@ -72,7 +67,7 @@
},
});
dispatch('resetPasswordSuccess');
onResetPasswordSuccess();
} catch (error) {
handleError(error, $t('errors.unable_to_reset_password'));
}