Skip to content

Commit

Permalink
MODIFIED: better subdomain handling to respect staging urls
Browse files Browse the repository at this point in the history
  • Loading branch information
sd-ditoy committed Jan 3, 2024
1 parent 379135b commit e7cee49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
10 changes: 8 additions & 2 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down

0 comments on commit e7cee49

Please sign in to comment.