Update qualifying, calendar and error page

This commit is contained in:
schooltechx 2023-04-04 20:40:56 +07:00
parent 24167f0650
commit 3a44bc2b33
5 changed files with 41 additions and 32 deletions

View file

@ -2,8 +2,6 @@
import { page } from '$app/stores';
</script>
<h1>{$page.error?.message}</h1>
<div>
มีบางอย่างไม่ถูกต้องกรุณาติดต่อ 02-xxxxxxxx
</div>
<div class="p-10">
<h1>{$page.error?.message}</h1>
</div>

View file

@ -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}
}

View file

@ -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:"ค้นหาโพสเกี่ยวกับการคัดเลือกไม่พบ"})
}