Skip to content

Commit

Permalink
fix(phone/language): reutrn default if browser env
Browse files Browse the repository at this point in the history
  • Loading branch information
itschip committed Sep 24, 2023
1 parent 19b54a5 commit cc8c966
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/phone/src/utils/language.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import phoneConfig from '../config/default.json';
import { fetchConfig } from './config';
import { isEnvBrowser } from './misc';

export const getDefaultLanguage = async () => {
if (isEnvBrowser()) return phoneConfig.defaultSettings.language;

const mainConfig = await fetchConfig();
const defaultLanguage = phoneConfig?.languages?.find(
(language) => language.value === mainConfig?.general.defaultLanguage,
);

return defaultLanguage ?? phoneConfig.defaultSettings.language;
return defaultLanguage;
};

0 comments on commit cc8c966

Please sign in to comment.