about page & load more button
This commit is contained in:
12
src/routes/getPosts/+server.js
Normal file
12
src/routes/getPosts/+server.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { env } from '$lib';
|
||||
import { error, json, text } from '@sveltejs/kit';
|
||||
import { get } from 'svelte/store';
|
||||
import { site_id } from '../store';
|
||||
|
||||
/** @type {import('./$types').RequestHandler} */
|
||||
export async function GET({fetch, url}) {
|
||||
const offset = url.searchParams.get("offset") || 0;
|
||||
const postsRes = await fetch(env.api_url + `/blog?blog_id=${get(site_id)}&offset=${offset}`).then(x=>x.json());
|
||||
|
||||
return json(postsRes.articles);
|
||||
}
|
||||
Reference in New Issue
Block a user