Use environtment variable to config API URL

This commit is contained in:
schooltechx 2023-04-10 17:58:14 +07:00
parent b803beca10
commit e3c74bb25e
13 changed files with 51 additions and 27 deletions

View file

@ -1,11 +1,11 @@
import {qualifyingBase} from '$lib/data/CMSDataType'
import { env } from '$env/dynamic/private'
import type {Exam} 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(qualifyingBase+"/qualifying/"+id)
const res = await fetch(env.API_QUALIFYING_URL+"/qualifying/"+id)
if(res.status==404){
throw error(404,{message:`ค้นหาข้อมูลสอบคัดเลือก ${id}ไม่พบ`})
}