import type { PageLoad } from './$types'; import { error } from '@sveltejs/kit'; import { server } from '../../../../helpers'; import { browser } from '$app/environment'; export const load: PageLoad = async ({ url, fetch, params }) => { let x = await await fetch( `${server}/api/discussion/${params.user}/${params.repo}/${params.disc}` ); if (x.status == 200) { let y = await x.json(); console.log('y', browser, y); if (browser) { let c = url.searchParams.get('edit_comment'); if (c) { y.edit_comment = c; } } return y; } else { throw error(404); } };