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