2022-11-07 16:53:47 -05:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { api, UserResponseDto } from '@api';
|
|
|
|
|
import { createEventDispatcher } from 'svelte';
|
2023-06-30 21:53:16 +02:00
|
|
|
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
|
2022-11-07 16:53:47 -05:00
|
|
|
|
|
|
|
|
export let user: UserResponseDto;
|
|
|
|
|
|
|
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
|
|
|
|
|
|
const restoreUser = async () => {
|
2023-05-28 04:52:22 +03:00
|
|
|
const restoredUser = await api.userApi.restoreUser({ userId: user.id });
|
2022-11-07 16:53:47 -05:00
|
|
|
if (restoredUser.data.deletedAt == null) dispatch('user-restore-success');
|
|
|
|
|
else dispatch('user-restore-fail');
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
2023-06-30 21:53:16 +02:00
|
|
|
<ConfirmDialogue
|
|
|
|
|
title="Restore User"
|
|
|
|
|
confirmText="Continue"
|
|
|
|
|
confirmColor="green"
|
|
|
|
|
on:confirm={restoreUser}
|
|
|
|
|
on:cancel
|
2022-11-07 16:53:47 -05:00
|
|
|
>
|
2023-06-30 21:53:16 +02:00
|
|
|
<svelte:fragment slot="prompt">
|
|
|
|
|
<p><b>{user.firstName} {user.lastName}</b>'s account will be restored.</p>
|
|
|
|
|
</svelte:fragment>
|
|
|
|
|
</ConfirmDialogue>
|