1
0
Fork 0
mirror of https://github.com/sussy-code/smov.git synced 2024-12-29 16:07:40 +01:00

fix bug I guess

This commit is contained in:
mrjvs 2023-12-12 22:53:35 +01:00
parent 848f2caaae
commit 6a446d5b2f

View file

@ -48,7 +48,11 @@ const env: Record<keyof Config, undefined | string> = {
// loads from different locations, in order: environment (VITE_{KEY}), window (public/config.js)
function getKeyValue(key: keyof Config): string | undefined {
let windowValue = (window as any)?.__CONFIG__?.[`VITE_${key}`];
if (windowValue !== undefined && windowValue.length === 0)
if (
windowValue !== null &&
windowValue !== undefined &&
windowValue.length === 0
)
windowValue = undefined;
return env[key] ?? windowValue ?? undefined;
}