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

14 lines
591 B
TypeScript
Raw Normal View History

2023-04-05 19:35:08 +07:00
import content from "$lib/data/content/competitive.html?raw"
2023-04-04 12:39:11 +07:00
import {getCompetitiveExams} from "$lib/data/info"
import type { PageServerLoad } from './$types'
2023-04-05 17:59:43 +07:00
import type {CalendarEvent} from '$lib/components/CalendarEvent'
2023-04-04 12:39:11 +07:00
export const load: PageServerLoad = async () => {
const exams = await getCompetitiveExams()
2023-04-05 17:59:43 +07:00
const events:CalendarEvent[]=[]
exams.forEach(({id,title,start})=>{
2023-04-06 10:46:37 +07:00
const backgroundColor ="#9999FF"
2023-04-05 17:59:43 +07:00
const url = "/competitive/"+id
events.push({id,title,start,url,backgroundColor})
})
2023-04-05 19:35:08 +07:00
return {content,exams,events}
2023-04-06 10:46:37 +07:00
}