mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-02-07 14:23:38 +01:00
Load the local hostname's config, where possible
This commit is contained in:
parent
a142630ff9
commit
5ea2d15964
1 changed files with 6 additions and 2 deletions
|
@ -4,8 +4,12 @@ import { ClientConfig } from '../hooks/useClientConfig';
|
||||||
import { trimTrailingSlash } from '../utils/common';
|
import { trimTrailingSlash } from '../utils/common';
|
||||||
|
|
||||||
const getClientConfig = async (): Promise<ClientConfig> => {
|
const getClientConfig = async (): Promise<ClientConfig> => {
|
||||||
const url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.json`;
|
let url = `${trimTrailingSlash(import.meta.env.BASE_URL)}/config.${window.location.hostname}.json`;
|
||||||
const config = await fetch(url, { method: 'GET' });
|
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();
|
return config.json();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue