Update qualifying, calendar and error page
This commit is contained in:
parent
24167f0650
commit
3a44bc2b33
5 changed files with 41 additions and 32 deletions
|
|
@ -17,7 +17,8 @@ export const load: PageServerLoad = async () => {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
events.push({id,title,start,backgroundColor})
|
||||
const url = "/qualifying/"+id
|
||||
events.push({id,title,start,url,backgroundColor})
|
||||
})
|
||||
return {exams,events}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,18 @@
|
|||
|
||||
import type { PageServerLoad } from './$types'
|
||||
import { error } from '@sveltejs/kit'
|
||||
import {getQualifyExams} from "$lib/data/info"
|
||||
export const load: PageServerLoad = async ({params}) => {
|
||||
const id = params.id
|
||||
return {id}
|
||||
const id = params.id+""
|
||||
const exams = await getQualifyExams()
|
||||
const post = exams.find((q)=>{
|
||||
return q.id===id
|
||||
})
|
||||
|
||||
if(post)
|
||||
return post
|
||||
else
|
||||
throw error(404,{message:"ค้นหาโพสเกี่ยวกับการคัดเลือกไม่พบ"})
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue