diff options
Diffstat (limited to 'subprojects/frontend/src/xtext/fetchBackendConfig.ts')
-rw-r--r-- | subprojects/frontend/src/xtext/fetchBackendConfig.ts | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/subprojects/frontend/src/xtext/fetchBackendConfig.ts b/subprojects/frontend/src/xtext/fetchBackendConfig.ts index f8087a70..15e976d8 100644 --- a/subprojects/frontend/src/xtext/fetchBackendConfig.ts +++ b/subprojects/frontend/src/xtext/fetchBackendConfig.ts | |||
@@ -1,15 +1,7 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-redeclare -- Declare types with their companion objects */ | 1 | import BackendConfig, { ENDPOINT } from './BackendConfig'; |
2 | |||
3 | import { z } from 'zod'; | ||
4 | |||
5 | export const BackendConfig = z.object({ | ||
6 | webSocketURL: z.string().url(), | ||
7 | }); | ||
8 | |||
9 | export type BackendConfig = z.infer<typeof BackendConfig>; | ||
10 | 2 | ||
11 | export default async function fetchBackendConfig(): Promise<BackendConfig> { | 3 | export default async function fetchBackendConfig(): Promise<BackendConfig> { |
12 | const configURL = `${import.meta.env.BASE_URL}config.json`; | 4 | const configURL = `${import.meta.env.BASE_URL}${ENDPOINT}`; |
13 | const response = await fetch(configURL); | 5 | const response = await fetch(configURL); |
14 | const rawConfig = (await response.json()) as unknown; | 6 | const rawConfig = (await response.json()) as unknown; |
15 | return BackendConfig.parse(rawConfig); | 7 | return BackendConfig.parse(rawConfig); |