Open History to see the last commit
1import { json } from '@sveltejs/kit'
2import type { RequestHandler } from './$types'
3β
4export const GET: RequestHandler = async ({ url }) => {
5 const page = parseInt(url.searchParams.get('page') ?? '') || 0
6β
7 const pageSize = 10
8β
9 const projects = Array(pageSize)
10 .fill(0)
11 .map((_, i) => {
12 const id = page * pageSize + (i + 1)
13 return {
14 name: 'Project ' + id,
15 id,
16 }
17 })
18β
19 await new Promise((r) => setTimeout(r, 1000))
20β
21 return json({ projects, hasMore: page < 9 })
22}