Hack browser locale on try page.

This commit is contained in:
Paulo Gustavo Veiga 2022-02-23 16:28:47 -08:00
parent 88ca3d92d0
commit 4e01d20ad4

View File

@ -17,8 +17,16 @@ export class Locale {
export default abstract class AppI18n { export default abstract class AppI18n {
public static getUserLocale(): Locale { public static getUserLocale(): Locale {
const account = fetchAccount(); // @Todo Hack: Try page must not account info. Add this to avoid 403 errors.
return account?.locale ? account.locale : this.getBrowserLocale(); const isTryPage = window.location.href.endsWith('/try');
let result: Locale;
if (!isTryPage) {
const account = fetchAccount();
result = account?.locale ? account.locale : this.getBrowserLocale();
} else {
result = this.getBrowserLocale();
}
return result;
} }
public static getBrowserLocale(): Locale { public static getBrowserLocale(): Locale {