From 5ea2d159640ebc01522d5fe55f3bd0deaa0e0f12 Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Sat, 30 Nov 2024 00:33:59 +0000 Subject: [PATCH] Load the local hostname's config, where possible --- src/app/components/ClientConfigLoader.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/components/ClientConfigLoader.tsx b/src/app/components/ClientConfigLoader.tsx index 72d367c06..7281cf2ea 100644 --- a/src/app/components/ClientConfigLoader.tsx +++ b/src/app/components/ClientConfigLoader.tsx @@ -4,8 +4,12 @@ import { ClientConfig } from '../hooks/useClientConfig'; import { trimTrailingSlash } from '../utils/common'; const getClientConfig = async (): Promise => { - const url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.json`; - const config = await fetch(url, { method: 'GET' }); + let url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.${window.location.hostname}.json`; + let config = await fetch(url, { method: 'GET' }); + if(config.status===404) { + url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.json`; + config = await fetch(url, { method: 'GET' }); + } return config.json(); };