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 8948eec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
Empty file added public/.nojekyll
Empty file.
15 changes: 5 additions & 10 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
<!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
console.log(fullPath)
sessionStorage.setItem('redirectPath', fullPath)
window.location.replace('/')
</script>
</head>
<body></body>
Expand Down
11 changes: 11 additions & 0 deletions src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const routes = [
name: 'posterMaker',
path: '/poster-maker',
},
// { path: '/404', component: NotFound },
],
component: PageLayout,
},
Expand Down Expand Up @@ -76,4 +77,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 8948eec

Please sign in to comment.