hrms-exam/cms/src/routes/+page.server.ts

23 lines
738 B
TypeScript
Raw Normal View History

//import content from "$lib/data/content/home.html?raw"
//import { getQualifyExams,getCompetitiveExams } from '$lib/data/info';
2023-04-04 12:39:11 +07:00
import type { PageServerLoad } from './$types';
import type {Exam} from '$lib/components/Exam'
export const load: PageServerLoad = async ({fetch}) => {
let qualify_exams: Exam[] = []
let competitive_exams: Exam[] = []
let content = ""
let res = await fetch("/api/content?page=home")
if(res.ok){
content = (await res.json()).content
}
res = await fetch("/api/qualifying")
if(res.ok){
qualify_exams = await res.json()
}
res = await fetch("/api/competitive")
if(res.ok){
competitive_exams = await res.json()
}
2023-04-05 17:59:43 +07:00
return { content , qualify_exams,competitive_exams };
2023-04-04 12:39:11 +07:00
};