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

Agrim/DPROD-4182 redirection mn and km #7797

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading