From 4e01d20ad4d6c0d559a5d022b246aebe4fc6cee6 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Wed, 23 Feb 2022 16:28:47 -0800 Subject: [PATCH] Hack browser locale on try page. --- packages/webapp/src/classes/app-i18n/index.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/webapp/src/classes/app-i18n/index.ts b/packages/webapp/src/classes/app-i18n/index.ts index b361721a..787ece57 100644 --- a/packages/webapp/src/classes/app-i18n/index.ts +++ b/packages/webapp/src/classes/app-i18n/index.ts @@ -17,8 +17,16 @@ export class Locale { export default abstract class AppI18n { public static getUserLocale(): Locale { - const account = fetchAccount(); - return account?.locale ? account.locale : this.getBrowserLocale(); + // @Todo Hack: Try page must not account info. Add this to avoid 403 errors. + 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 {