Skip to content

Commit

Permalink
Merge pull request #83 from casper-network/subdomain-handling-improve…
Browse files Browse the repository at this point in the history
…ment

Subdomain handling improvement
  • Loading branch information
sd-ditoy authored Jan 3, 2024
2 parents 379135b + bf6b0ac commit cbf406b
Show file tree
Hide file tree
Showing 2 changed files with 9 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
9 changes: 7 additions & 2 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,16 @@ 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', '');
}
ignoreLanguage = true;
language = 'en-us';
}
Expand Down

0 comments on commit cbf406b

Please sign in to comment.