preload
This commit is contained in:
parent
09557ee3ac
commit
db292ea0a8
5 changed files with 18 additions and 11 deletions
|
@ -36,10 +36,6 @@
|
|||
|
||||
<svelte:window bind:scrollY={y} />
|
||||
|
||||
<svelte:head>
|
||||
<link rel="preload" type="application/json" as="json" href="/api/entries" />
|
||||
</svelte:head>
|
||||
|
||||
<div class="relative col-[content] pr-0.5">
|
||||
{#await entriesPromise}
|
||||
<p class="text-center">Loading entries...</p>
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,9 +1,9 @@
|
|||
<script lang="ts">
|
||||
import './index.css';
|
||||
import Header from './components/header.svelte';
|
||||
import Main from './components/main.svelte';
|
||||
import Login from './components/login.svelte';
|
||||
import Main from './components/main.svelte';
|
||||
import ProgressTable from './components/progress-table.svelte';
|
||||
import './index.css';
|
||||
import { userstate } from './shared.svelte';
|
||||
</script>
|
||||
|
||||
|
@ -13,6 +13,13 @@
|
|||
>
|
||||
Skip to main content
|
||||
</a>
|
||||
|
||||
<svelte:head>
|
||||
{#if userstate.isLoggedIn}
|
||||
<link rel="preload" type="application/json" as="fetch" href="/api/entries" />
|
||||
{/if}
|
||||
</svelte:head>
|
||||
|
||||
<Header></Header>
|
||||
<Main>
|
||||
{#if !userstate.isLoggedIn}
|
||||
|
|
|
@ -38,7 +38,11 @@ Bun.serve({
|
|||
|
||||
const data = await ptApi.query();
|
||||
const body = JSON.stringify(data);
|
||||
return new Response(body, { headers: { 'Content-Type': 'application/json' } });
|
||||
return new Response(body, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
'/auth/logout': {
|
||||
|
@ -48,7 +52,8 @@ Bun.serve({
|
|||
},
|
||||
'/auth/login': {
|
||||
async POST(req) {
|
||||
const data = await req.json();
|
||||
const json = await req.json();
|
||||
const data = json as Record<string, any>;
|
||||
const email = data.email;
|
||||
const password = data.password;
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ export async function fetchEntries(): Promise<SelectBookmark[]> {
|
|||
try {
|
||||
const response = await fetch('/api/entries', {
|
||||
method: 'GET',
|
||||
credentials: 'include',
|
||||
mode: 'same-origin',
|
||||
mode: 'no-cors'
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue