fix: load turnstile script in layout and explicitly render

chore: npm run format + lint
This commit is contained in:
2026-01-04 09:22:27 -05:00
parent 24b25c2291
commit 2c24af5ac9
11 changed files with 109 additions and 91 deletions
@@ -1,34 +1,31 @@
<script lang="ts">
import { resolve } from '$app/paths';
import type { PageData } from './$types';
import type { Pagination } from '$lib/types/pagination';
import type { Pagination } from '$lib/types/pagination';
import { User, CalendarDays, ShieldUser, Ban, File, AtSign } from '@lucide/svelte';
import { extractDateFromUUIDv7, tooltip } from '$lib/utils/misc';
import { roles } from '$lib/consts';
import { getToken } from '$lib/utils/auth';
import { getToken } from '$lib/utils/auth';
export let data: PageData;
let currentPage = data.user.pagination?.page ?? 1;
let pagination: Pagination = data.user.pagination ?? {
page: 1,
pageSize: 50,
totalCount: 0,
totalPages: 1
};
page: 1,
pageSize: 50,
totalCount: 0,
totalPages: 1
};
let pastes = data.user.pastes ?? [];
let loading = false;
async function fetchPage(pageNum: number) {
if (pageNum < 1 || pageNum > (pagination.totalPages || 1) || loading) return;
loading = true;
const token = getToken();
const res = await fetch(
`/api/user/${data.user.username}?page=${pageNum}`,
{
headers: token ? { Authorization: `Bearer ${token}` } : {}
}
);
const token = getToken();
const res = await fetch(`/api/user/${data.user.username}?page=${pageNum}`, {
headers: token ? { Authorization: `Bearer ${token}` } : {}
});
if (!res.ok) {
loading = false;
return;