Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
chore: redirection fix for mn and km
Browse files Browse the repository at this point in the history
  • Loading branch information
agrim-deriv committed Jun 14, 2024
1 parent 98d46f1 commit 527d7ec
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions themes/gatsby-theme-deriv/gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,22 @@ export const onRouteUpdate = ({ location }) => {
const client_information = getClientInformation(domain)
const is_logged_in = !!client_information

const path = location.pathname;

if (path === '/mn') {
navigate('/', { replace: true });
} else if (path.startsWith('/mn/')) {
const newPath = path.replace(/^\/mn/, '');
navigate(newPath || '/', { replace: true });
}

if (path === '/km') {
navigate('/', { replace: true });
} else if (path.startsWith('/km/')) {
const newPath = path.replace(/^\/km/, '');
navigate(newPath || '/', { replace: true });
}

// wrap inside a timeout to ensure the title has properly been changed
setTimeout(() => {
const eventName = 'page_load'
Expand Down

0 comments on commit 527d7ec

Please sign in to comment.