Don't break the back button when redirecting legacy routes (#4305)

* Don't break the back button when redirecting legacy routes

* Prettier
This commit is contained in:
Federico Brigante
2019-11-12 22:17:59 +07:00
committed by Caleb Cartwright
parent a3989dd0bd
commit 66f86bf1f7

View File

@@ -4,8 +4,12 @@ export default function redirectLegacyRoutes() {
const { hash } = window.location
if (hash && hash.startsWith('#/examples/')) {
const category = hash.replace('#/examples/', '')
navigate(`category/${category}`)
navigate(`category/${category}`, {
replace: true,
})
} else if (hash === '#/endpoint') {
navigate('endpoint')
navigate('endpoint', {
replace: true,
})
}
}