Connect Real API of qualify exam and cms info
This commit is contained in:
parent
acfe81c58a
commit
f536b6e2e9
15 changed files with 34 additions and 31 deletions
|
|
@ -1,11 +1,11 @@
|
|||
import {apibase} from '$lib/data/CMSDataType'
|
||||
import {qualifyingBase} from '$lib/data/CMSDataType'
|
||||
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 exams:Exam[] = []
|
||||
const res = await fetch(apibase+"/qualifying")
|
||||
const res = await fetch(qualifyingBase+"/qualifying")
|
||||
if(!res.ok)
|
||||
throw error(res.status, 'ไม่สามารถอ่านข้อมูลการสอบได้');
|
||||
exams = await res.json()
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import {apibase} from '$lib/data/CMSDataType'
|
||||
import {qualifyingBase} from '$lib/data/CMSDataType'
|
||||
import { error } from '@sveltejs/kit'
|
||||
import dayjs from 'dayjs'
|
||||
import type { PageServerLoad } from './$types'
|
||||
export const load: PageServerLoad = async ({params,fetch}) => {
|
||||
const id = params.id+""
|
||||
const res = await fetch(apibase+"/qualifying/"+id)
|
||||
const res = await fetch(qualifyingBase+"/qualifying/"+id)
|
||||
if(res.status==404){
|
||||
throw error(404,{message:`ค้นหาข้อมูลสอบคัดเลือก ${id}ไม่พบ`})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue