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: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">
|
<div class="relative col-[content] pr-0.5">
|
||||||
{#await entriesPromise}
|
{#await entriesPromise}
|
||||||
<p class="text-center">Loading entries...</p>
|
<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">
|
<script lang="ts">
|
||||||
import './index.css';
|
|
||||||
import Header from './components/header.svelte';
|
import Header from './components/header.svelte';
|
||||||
import Main from './components/main.svelte';
|
|
||||||
import Login from './components/login.svelte';
|
import Login from './components/login.svelte';
|
||||||
|
import Main from './components/main.svelte';
|
||||||
import ProgressTable from './components/progress-table.svelte';
|
import ProgressTable from './components/progress-table.svelte';
|
||||||
|
import './index.css';
|
||||||
import { userstate } from './shared.svelte';
|
import { userstate } from './shared.svelte';
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -13,6 +13,13 @@
|
||||||
>
|
>
|
||||||
Skip to main content
|
Skip to main content
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
{#if userstate.isLoggedIn}
|
||||||
|
<link rel="preload" type="application/json" as="fetch" href="/api/entries" />
|
||||||
|
{/if}
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
<Header></Header>
|
<Header></Header>
|
||||||
<Main>
|
<Main>
|
||||||
{#if !userstate.isLoggedIn}
|
{#if !userstate.isLoggedIn}
|
||||||
|
|
|
@ -38,7 +38,11 @@ Bun.serve({
|
||||||
|
|
||||||
const data = await ptApi.query();
|
const data = await ptApi.query();
|
||||||
const body = JSON.stringify(data);
|
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': {
|
'/auth/logout': {
|
||||||
|
@ -48,7 +52,8 @@ Bun.serve({
|
||||||
},
|
},
|
||||||
'/auth/login': {
|
'/auth/login': {
|
||||||
async POST(req) {
|
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 email = data.email;
|
||||||
const password = data.password;
|
const password = data.password;
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,7 @@ export async function fetchEntries(): Promise<SelectBookmark[]> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/api/entries', {
|
const response = await fetch('/api/entries', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
credentials: 'include',
|
mode: 'no-cors'
|
||||||
mode: 'same-origin',
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue