mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-01-31 09:49:10 +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';
|
||||
|
||||
const getClientConfig = async (): Promise<ClientConfig> => {
|
||||
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();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue