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

Commit

Permalink
Agrim/DPROD-4182 redirection mn and km (#7797)
Browse files Browse the repository at this point in the history
* chore: redirection fix for mn and km

* fix: empty commit

* fix: revert previous pr change
  • Loading branch information
agrim-deriv authored Jun 19, 2024
1 parent bf0f2e0 commit 1697024
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 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
13 changes: 0 additions & 13 deletions themes/gatsby-theme-deriv/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,19 +250,6 @@ const BuildPage = (page, actions, region) => {
redirectInBrowser: true,
isPermanent: true,
})
const mn_path = `/mn${localized_path.slice(0, -1)}`
createRedirect({
fromPath: mn_path,
toPath: localized_path,
redirectInBrowser: true,
isPermanent: true,
})
createRedirect({
fromPath: `${mn_path}/`,
toPath: localized_path,
redirectInBrowser: true,
isPermanent: true,
})
}

if (is_responsible_trading) {
Expand Down

0 comments on commit 1697024

Please sign in to comment.