Skip to content

Commit

Permalink
404
Browse files Browse the repository at this point in the history
  • Loading branch information
al committed Jun 28, 2024
1 parent 3b3d586 commit eb26ce8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
Empty file added public/.nojekyll
Empty file.
14 changes: 4 additions & 10 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
<!doctype html>
<html>
<head>
<meta
content="0;url=/"
http-equiv="refresh"
/>
<script>
var pathname = window.location.pathname
var search = window.location.search
var hash = window.location.hash

window.location.replace('/?' + pathname + search + hash)
<script type="text/javascript">
var fullPath = window.location.pathname + window.location.search + window.location.hash
sessionStorage.setItem('redirectPath', fullPath)
window.location.replace('/')
</script>
</head>
<body></body>
Expand Down
10 changes: 10 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,14 @@ const router = createRouter({
},
})

router.beforeEach((to, from, next) => {
const redirectPath = sessionStorage.getItem('redirectPath')
if (redirectPath) {
sessionStorage.removeItem('redirectPath')
next(redirectPath)
} else {
next()
}
})

export default router

0 comments on commit eb26ce8

Please sign in to comment.