Files
shields/frontend/lib/redirect-legacy-routes.ts
François Hodierne 0d8a2d5ca0 Update to eslint 6.8.0 [appveyor githubissuedetail packagist] (#4489)
* update to eslint 6.8.0 and related packages

* Fixes for no-prototype-builtins

* Updates for explicit-function-return-type

* Add ignores for no-explicit-any

* update to eslint 6.8.0 and related packages

* Fixes for no-prototype-builtins

* Updates for explicit-function-return-type

* Add ignores for no-explicit-any

* package: activate eslint-config-standard

* apply updated eslint configuration

* lint: apply eslint feedback after rebase

* Update lockfile

* Update lockfile

* Restore missing deps

* Update lockfile

* Re-add eslint-plugin-node

* Add eslint-plugin-standard and eslint-plugin-react-hooks

* Clean lint

Co-authored-by: Paul Melnikow <github@paulmelnikow.com>
2020-02-29 11:06:36 -06:00

16 lines
392 B
TypeScript

import { navigate } from 'gatsby'
export default function redirectLegacyRoutes(): void {
const { hash } = window.location
if (hash && hash.startsWith('#/examples/')) {
const category = hash.replace('#/examples/', '')
navigate(`category/${category}`, {
replace: true,
})
} else if (hash === '#/endpoint') {
navigate('endpoint', {
replace: true,
})
}
}