add flake and move to npm
This commit is contained in:
2317
src/lib/network-status.json
Normal file
2317
src/lib/network-status.json
Normal file
File diff suppressed because it is too large
Load Diff
1
src/routes/+layout.ts
Normal file
1
src/routes/+layout.ts
Normal file
@@ -0,0 +1 @@
|
||||
export const prerender = true
|
||||
@@ -1,9 +1,16 @@
|
||||
import type { NetworkStatus } from '$lib/types'
|
||||
import networkData from '$lib/network-status.json'
|
||||
import type { PageLoad } from './$types'
|
||||
|
||||
export const load: PageLoad = async () => {
|
||||
export const ssr = false
|
||||
|
||||
const API_PORT = import.meta.env.PUBLIC_API_PORT ?? '8080'
|
||||
|
||||
export const load: PageLoad = async ({ fetch, url }) => {
|
||||
const apiUrl = `${url.protocol}//${url.hostname}:${API_PORT}`
|
||||
const response = await fetch(apiUrl)
|
||||
const networkStatus: NetworkStatus = await response.json()
|
||||
|
||||
return {
|
||||
networkStatus: networkData as NetworkStatus,
|
||||
networkStatus,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user