From e7cee494d2021e0f0705fa0f5ac7b22750645b30 Mon Sep 17 00:00:00 2001 From: Sandro Ducceschi Date: Wed, 3 Jan 2024 16:35:38 +0100 Subject: [PATCH 1/2] MODIFIED: better subdomain handling to respect staging urls --- src/components/Header.vue | 3 ++- src/router/index.js | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/components/Header.vue b/src/components/Header.vue index 9f0cb5c..583e28d 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -197,7 +197,8 @@ export default { // destroyed() {}, methods: { testForCountryPage() { - this.hideNavigation = /^[a-zA-Z]{2}.casper.network/.test(window.location.hostname); + const { hostname } = window.location; + this.hideNavigation = /^[a-zA-Z]{2}.casper.network/.test(hostname) || /^[a-zA-Z]{2}.staging.casper.network/.test(hostname); }, goHome() { if (this.hideNavigation) { diff --git a/src/router/index.js b/src/router/index.js index 7b6fc56..324d64e 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -86,11 +86,17 @@ export function getRouter() { let isCountryLP = false; let countryCode = null; - const hostname = window.location.hostname; + const { hostname } = window.location; - if (/^[a-zA-Z]{2}.casper.network/.test(hostname)) { + const prodDomainTest = /^[a-zA-Z]{2}.casper.network/.test(hostname); + const stagingDomainTest = /^[a-zA-Z]{2}.staging.casper.network/.test(hostname); + if (prodDomainTest || stagingDomainTest) { isCountryLP = true; countryCode = hostname.replace('.casper.network', ''); + if (countryCode.includes('.')) { + countryCode = hostname.replace('.staging.casper.network', ''); + } + console.log(countryCode); ignoreLanguage = true; language = 'en-us'; } From bf6b0ac0086dc42d2bc5023e486121dec8f3a321 Mon Sep 17 00:00:00 2001 From: Sandro Ducceschi Date: Wed, 3 Jan 2024 16:36:33 +0100 Subject: [PATCH 2/2] MODIFIED: remove unnecessary console.log --- src/router/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/router/index.js b/src/router/index.js index 324d64e..ea6f1d3 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -96,7 +96,6 @@ export function getRouter() { if (countryCode.includes('.')) { countryCode = hostname.replace('.staging.casper.network', ''); } - console.log(countryCode); ignoreLanguage = true; language = 'en-us'; }