Clean data and update mockup api spec
This commit is contained in:
parent
aaff6c92b8
commit
9012d03515
13 changed files with 171 additions and 77 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import type { PageServerLoad } from './$types'
|
||||
import { error } from '@sveltejs/kit';
|
||||
import type {CalendarEvent,Exam} from '$lib/data/CMSDataType'
|
||||
import dayjs from 'dayjs'
|
||||
import type { PageServerLoad } from './$types'
|
||||
export const load: PageServerLoad = async ({fetch}) => {
|
||||
let content = ""
|
||||
let exams:Exam[] = []
|
||||
|
|
@ -10,9 +11,10 @@ export const load: PageServerLoad = async ({fetch}) => {
|
|||
}
|
||||
|
||||
res = await fetch("/api/competitive")
|
||||
if(res.ok){
|
||||
exams = await res.json()
|
||||
if(!res.ok){
|
||||
throw error(res.status, 'ไม่สามารถอ่านข้อมูลการสอบได้');
|
||||
}
|
||||
exams = await res.json()
|
||||
|
||||
const events:CalendarEvent[]=[]
|
||||
exams.forEach((e)=>{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue