Upgrade package, Implement fake API, version info get from API. Waiting for real API
This commit is contained in:
parent
faaae95956
commit
5b2d7ea68d
16 changed files with 853 additions and 615 deletions
31
cms/src/routes/api/content/+server.ts
Normal file
31
cms/src/routes/api/content/+server.ts
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
import type { RequestEvent, RequestHandler } from './$types'
|
||||
import {json} from '@sveltejs/kit'
|
||||
import home_content from "$lib/data/content/home.html?raw"
|
||||
import about_content from "$lib/data/content/about.html?raw"
|
||||
import qualifying_content from "$lib/data/content/qualifying.html?raw"
|
||||
import competitive_content from "$lib/data/content/competitive.html?raw"
|
||||
export const GET: RequestHandler = async ({url}: RequestEvent) => {
|
||||
let content = ""
|
||||
const page= url.searchParams.get("page") ?? 'nopage'
|
||||
switch (page) {
|
||||
case "home":
|
||||
content = home_content
|
||||
break;
|
||||
case "qualifying":
|
||||
content = qualifying_content
|
||||
break;
|
||||
case "competitive":
|
||||
content = competitive_content
|
||||
break;
|
||||
case "about":
|
||||
content = about_content
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
//slience error just send empty content if not found
|
||||
if(!content)
|
||||
console.log(`Request content ${page} not found`)
|
||||
return json({content})
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue