Restructure admin
This commit is contained in:
parent
86cfb4eb46
commit
39cf332500
@ -1,2 +1,7 @@
|
|||||||
<h1>Welcome to SvelteKit</h1>
|
<script lang="ts">
|
||||||
<p>Visit <a href="https://kit.svelte.dev">kit.svelte.dev</a> to read the documentation</p>
|
import { browser } from '$app/environment';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
if (browser) {
|
||||||
|
goto('/login');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
@ -35,12 +35,12 @@
|
|||||||
async function onSubmitClick() {
|
async function onSubmitClick() {
|
||||||
if (incorrectBtn.checked) {
|
if (incorrectBtn.checked) {
|
||||||
let data: DiffPostData = { correct: false, message: messageText.value };
|
let data: DiffPostData = { correct: false, message: messageText.value };
|
||||||
await fetch('/diff-test', { method: 'POST', body: JSON.stringify(data) });
|
await fetch('/admin/diff', { method: 'POST', body: JSON.stringify(data) });
|
||||||
goto('/reviews');
|
goto('/admin/reviews');
|
||||||
} else if (correctBtn.checked) {
|
} else if (correctBtn.checked) {
|
||||||
let data: DiffPostData = { correct: true, message: messageText.value };
|
let data: DiffPostData = { correct: true, message: messageText.value };
|
||||||
await fetch('/diff-test', { method: 'POST', body: JSON.stringify(data) });
|
await fetch('/admin/diff', { method: 'POST', body: JSON.stringify(data) });
|
||||||
goto('/reviews');
|
goto('/admin/reviews');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
<h1 class="mb-4">Diff Test</h1>
|
<h1 class="mb-4">Diff Test</h1>
|
||||||
|
|
||||||
<a href="/reviews" class="btn btn-outline-primary">Back</a>
|
<a href="/admin/reviews" class="btn btn-outline-primary">Back</a>
|
||||||
<div class="mt-3" id="diff" />
|
<div class="mt-3" id="diff" />
|
||||||
|
|
||||||
<h5>Message</h5>
|
<h5>Message</h5>
|
@ -8,6 +8,6 @@
|
|||||||
|
|
||||||
<ul class="list-group">
|
<ul class="list-group">
|
||||||
{#each data.reviewList as review}
|
{#each data.reviewList as review}
|
||||||
<a href="/diff-test" class="list-group-item list-group-item-action">{review}</a>
|
<a href="/admin/diff" class="list-group-item list-group-item-action">{review}</a>
|
||||||
{/each}
|
{/each}
|
||||||
</ul>
|
</ul>
|
@ -1,7 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { browser } from '$app/environment';
|
||||||
import { enhance } from '$app/forms';
|
import { enhance } from '$app/forms';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
import type { ActionData } from './$types';
|
import type { ActionData } from './$types';
|
||||||
export let form: ActionData;
|
export let form: ActionData;
|
||||||
|
|
||||||
|
$: if (browser) {
|
||||||
|
if (form && form.success) {
|
||||||
|
goto('/admin/reviews');
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="mt-4 row justify-content-center">
|
<div class="mt-4 row justify-content-center">
|
||||||
|
Loading…
Reference in New Issue
Block a user