2024-07-31 10:29:46 +02:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { enhance } from "$app/forms";
|
2024-08-02 15:33:18 +02:00
|
|
|
import Modal from "$lib/components/Modal.svelte";
|
2024-08-02 16:36:21 +02:00
|
|
|
import SuccessOrError from "$lib/components/SuccessOrError.svelte";
|
2024-08-05 14:38:44 +02:00
|
|
|
import type { ActionData, PageServerData } from "./$types";
|
2024-07-31 10:29:46 +02:00
|
|
|
|
2024-08-20 19:17:05 +02:00
|
|
|
const { data, form }: { data: PageServerData; form: ActionData } = $props();
|
2024-07-31 10:29:46 +02:00
|
|
|
</script>
|
|
|
|
|
|
2024-08-02 16:36:21 +02:00
|
|
|
<SuccessOrError success={form?.success} message={form?.message} />
|
2024-08-01 18:09:35 +02:00
|
|
|
|
2024-08-24 21:43:15 +02:00
|
|
|
<section id="overview">
|
|
|
|
|
<h2>
|
|
|
|
|
<a href="#overview">Overview</a>
|
|
|
|
|
</h2>
|
2024-07-31 10:29:46 +02:00
|
|
|
|
2024-08-03 13:49:41 +02:00
|
|
|
<ul>
|
|
|
|
|
<li>
|
|
|
|
|
<strong>Id:</strong>
|
|
|
|
|
{data.user.id}
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<strong>Username:</strong>
|
|
|
|
|
{data.user.username}
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
2024-07-31 10:29:46 +02:00
|
|
|
</section>
|
|
|
|
|
|
2024-08-24 21:43:15 +02:00
|
|
|
<section id="logout">
|
|
|
|
|
<h2>
|
|
|
|
|
<a href="#logout">Logout</a>
|
|
|
|
|
</h2>
|
2024-07-31 10:29:46 +02:00
|
|
|
|
|
|
|
|
<form method="POST" action="?/logout" use:enhance>
|
|
|
|
|
<button type="submit">Logout</button>
|
|
|
|
|
</form>
|
|
|
|
|
</section>
|
|
|
|
|
|
2024-08-24 21:43:15 +02:00
|
|
|
<section id="delete-account">
|
|
|
|
|
<h2>
|
|
|
|
|
<a href="#delete-account">Delete account</a>
|
|
|
|
|
</h2>
|
2024-07-31 10:29:46 +02:00
|
|
|
|
2024-08-02 15:33:18 +02:00
|
|
|
<Modal id="delete-account" text="Delete account">
|
|
|
|
|
<h3>Delete account</h3>
|
2024-07-31 10:29:46 +02:00
|
|
|
|
2024-08-02 15:33:18 +02:00
|
|
|
<p>
|
|
|
|
|
<strong>Caution!</strong>
|
|
|
|
|
Deleting your account will irretrievably erase all data.
|
|
|
|
|
</p>
|
|
|
|
|
|
2024-08-02 16:36:21 +02:00
|
|
|
<form
|
|
|
|
|
method="POST"
|
|
|
|
|
action="?/deleteAccount"
|
|
|
|
|
use:enhance={() => {
|
|
|
|
|
return async ({ update }) => {
|
|
|
|
|
await update();
|
|
|
|
|
window.location.hash = "!";
|
|
|
|
|
};
|
|
|
|
|
}}
|
|
|
|
|
>
|
2024-08-02 15:33:18 +02:00
|
|
|
<label>
|
|
|
|
|
Password:
|
|
|
|
|
<input type="password" name="password" required />
|
|
|
|
|
</label>
|
|
|
|
|
|
2024-08-03 18:07:27 +02:00
|
|
|
<button type="submit">Delete account</button>
|
2024-08-02 15:33:18 +02:00
|
|
|
</form>
|
|
|
|
|
</Modal>
|
2024-07-31 10:29:46 +02:00
|
|
|
</section>
|