mirror of
https://github.com/immich-app/immich.git
synced 2025-05-30 19:54:52 -04:00
* chore(web): replace window.confirm by ConfirmDialogues and cleanup existing ones * fix(web): linter and svelte-check issues * fix(web): rephrase some confirm dialogs * fix(web): run prettier * fix(web): merge with last version and run prettier again * fix(web): run prettier
37 lines
1.1 KiB
Svelte
37 lines
1.1 KiB
Svelte
<script lang="ts">
|
|
import { api, UserResponseDto } from '@api';
|
|
import { createEventDispatcher } from 'svelte';
|
|
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
|
|
import { handleError } from '../../utils/handle-error';
|
|
|
|
export let user: UserResponseDto;
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
const deleteUser = async () => {
|
|
try {
|
|
const deletedUser = await api.userApi.deleteUser({ userId: user.id });
|
|
if (deletedUser.data.deletedAt != null) {
|
|
dispatch('user-delete-success');
|
|
} else {
|
|
dispatch('user-delete-fail');
|
|
}
|
|
} catch (error) {
|
|
handleError(error, 'Unable to delete user');
|
|
dispatch('user-delete-fail');
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<ConfirmDialogue title="Delete User" confirmText="Delete" on:confirm={deleteUser} on:cancel>
|
|
<svelte:fragment slot="prompt">
|
|
<div class="flex flex-col gap-4">
|
|
<p>
|
|
<b>{user.firstName} {user.lastName}</b>'s account and assets will be permanently deleted
|
|
after 7 days.
|
|
</p>
|
|
<p>Are you sure you want to continue?</p>
|
|
</div>
|
|
</svelte:fragment>
|
|
</ConfirmDialogue>
|