mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 10:51:36 +01:00
Add toast for errors and success messages
This commit is contained in:
@@ -4,17 +4,12 @@
|
||||
import { sortOptions } from "$lib/utils.js";
|
||||
import { page } from "$app/stores";
|
||||
import Modal from "$lib/components/Modal.svelte";
|
||||
import SuccessOrError from "$lib/components/SuccessOrError.svelte";
|
||||
|
||||
const { form, data } = $props();
|
||||
</script>
|
||||
|
||||
{#if form?.success}
|
||||
<p>{form.message}</p>
|
||||
{/if}
|
||||
|
||||
{#if form?.success === false}
|
||||
<p>{form.message}</p>
|
||||
{/if}
|
||||
<SuccessOrError success={form?.success} message={form?.message} />
|
||||
|
||||
<section>
|
||||
<h2>Create website</h2>
|
||||
@@ -22,7 +17,16 @@
|
||||
<Modal id="create-website" text="Create website">
|
||||
<h3>Create website</h3>
|
||||
|
||||
<form method="POST" action="?/createWebsite" use:enhance>
|
||||
<form
|
||||
method="POST"
|
||||
action="?/createWebsite"
|
||||
use:enhance={() => {
|
||||
return async ({ update }) => {
|
||||
await update();
|
||||
window.location.hash = "!";
|
||||
};
|
||||
}}
|
||||
>
|
||||
<label>
|
||||
Type:
|
||||
<select name="content-type">
|
||||
@@ -100,6 +104,7 @@
|
||||
use:enhance={() => {
|
||||
return async ({ update }) => {
|
||||
await update({ reset: false });
|
||||
window.location.hash = "!";
|
||||
};
|
||||
}}
|
||||
>
|
||||
@@ -119,7 +124,16 @@
|
||||
<strong>Caution!</strong>
|
||||
Deleting this website will irretrievably erase all data.
|
||||
</p>
|
||||
<form method="POST" action="?/deleteWebsite" use:enhance>
|
||||
<form
|
||||
method="POST"
|
||||
action="?/deleteWebsite"
|
||||
use:enhance={() => {
|
||||
return async ({ update }) => {
|
||||
await update();
|
||||
window.location.hash = "!";
|
||||
};
|
||||
}}
|
||||
>
|
||||
<input type="hidden" name="id" value={id} />
|
||||
|
||||
<button type="submit">Permanently delete website</button>
|
||||
|
||||
@@ -1,17 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { enhance } from "$app/forms";
|
||||
import Modal from "$lib/components/Modal.svelte";
|
||||
import SuccessOrError from "$lib/components/SuccessOrError.svelte";
|
||||
|
||||
const { data, form } = $props();
|
||||
</script>
|
||||
|
||||
{#if form?.success}
|
||||
<p>{form.message}</p>
|
||||
{/if}
|
||||
|
||||
{#if form?.success === false}
|
||||
<p>{form.message}</p>
|
||||
{/if}
|
||||
<SuccessOrError success={form?.success} message={form?.message} />
|
||||
|
||||
<section>
|
||||
<h2>Overview</h2>
|
||||
@@ -45,7 +40,16 @@
|
||||
Deleting your account will irretrievably erase all data.
|
||||
</p>
|
||||
|
||||
<form method="POST" action="?/deleteAccount" use:enhance>
|
||||
<form
|
||||
method="POST"
|
||||
action="?/deleteAccount"
|
||||
use:enhance={() => {
|
||||
return async ({ update }) => {
|
||||
await update();
|
||||
window.location.hash = "!";
|
||||
};
|
||||
}}
|
||||
>
|
||||
<label>
|
||||
Password:
|
||||
<input type="password" name="password" required />
|
||||
|
||||
@@ -2,17 +2,12 @@
|
||||
import { enhance } from "$app/forms";
|
||||
import WebsiteEditor from "$lib/components/WebsiteEditor.svelte";
|
||||
import { ALLOWED_MIME_TYPES } from "$lib/utils";
|
||||
import SuccessOrError from "$lib/components/SuccessOrError.svelte";
|
||||
|
||||
const { data, form } = $props();
|
||||
</script>
|
||||
|
||||
{#if form?.success}
|
||||
<p>{form.message}</p>
|
||||
{/if}
|
||||
|
||||
{#if form?.success === false}
|
||||
<p>{form.message}</p>
|
||||
{/if}
|
||||
<SuccessOrError success={form?.success} message={form?.message} />
|
||||
|
||||
<WebsiteEditor
|
||||
id={data.website.id}
|
||||
|
||||
@@ -4,17 +4,12 @@
|
||||
import { page } from "$app/stores";
|
||||
import { enhance } from "$app/forms";
|
||||
import Modal from "$lib/components/Modal.svelte";
|
||||
import SuccessOrError from "$lib/components/SuccessOrError.svelte";
|
||||
|
||||
const { data, form } = $props();
|
||||
</script>
|
||||
|
||||
{#if form?.success}
|
||||
<p>{form.message}</p>
|
||||
{/if}
|
||||
|
||||
{#if form?.success === false}
|
||||
<p>{form.message}</p>
|
||||
{/if}
|
||||
<SuccessOrError success={form?.success} message={form?.message} />
|
||||
|
||||
<WebsiteEditor
|
||||
id={data.website.id}
|
||||
@@ -27,7 +22,16 @@
|
||||
<Modal id="create-article" text="Create article">
|
||||
<h3>Create article</h3>
|
||||
|
||||
<form method="POST" action="?/createArticle" use:enhance>
|
||||
<form
|
||||
method="POST"
|
||||
action="?/createArticle"
|
||||
use:enhance={() => {
|
||||
return async ({ update }) => {
|
||||
await update();
|
||||
window.location.hash = "!";
|
||||
};
|
||||
}}
|
||||
>
|
||||
<label>
|
||||
Title:
|
||||
<input type="text" name="title" />
|
||||
@@ -78,7 +82,16 @@
|
||||
Deleting this article will irretrievably erase all data.
|
||||
</p>
|
||||
|
||||
<form method="POST" action="?/deleteArticle" use:enhance>
|
||||
<form
|
||||
method="POST"
|
||||
action="?/deleteArticle"
|
||||
use:enhance={() => {
|
||||
return async ({ update }) => {
|
||||
await update();
|
||||
window.location.hash = "!";
|
||||
};
|
||||
}}
|
||||
>
|
||||
<input type="hidden" name="id" value={id} />
|
||||
|
||||
<button type="submit">Permanently delete article</button>
|
||||
|
||||
@@ -2,17 +2,12 @@
|
||||
import { enhance } from "$app/forms";
|
||||
import WebsiteEditor from "$lib/components/WebsiteEditor.svelte";
|
||||
import { ALLOWED_MIME_TYPES } from "$lib/utils";
|
||||
import SuccessOrError from "$lib/components/SuccessOrError.svelte";
|
||||
|
||||
const { data, form } = $props();
|
||||
</script>
|
||||
|
||||
{#if form?.success}
|
||||
<p>{form.message}</p>
|
||||
{/if}
|
||||
|
||||
{#if form?.success === false}
|
||||
<p>{form.message}</p>
|
||||
{/if}
|
||||
<SuccessOrError success={form?.success} message={form?.message} />
|
||||
|
||||
<WebsiteEditor
|
||||
id={data.website.id}
|
||||
|
||||
Reference in New Issue
Block a user