Skip to content

Commit

Permalink
chore: path
Browse files Browse the repository at this point in the history
  • Loading branch information
lencx committed Nov 13, 2023
1 parent 1a9ce7c commit 8569094
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Page Not Found</title>
<script>
window.location.replace('/index.html' + '?path=' + window.location.pathname);
window.location.replace('/index.html' + '?uri=' + encodeURIComponent(window.location.href));
</script>
</head>
<body>
Expand Down
11 changes: 6 additions & 5 deletions src/layouts/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ export default function BaseLayout() {
useEffect(() => {
if (window.location.search) {
const params = new URLSearchParams(window.location.search);
const path = params.get('path');
if (path) {
navigate(`${window.location.origin}/${path}`);
const uri = params.get('uri');
if (uri) {
const url = decodeURIComponent(encodeURIComponent(uri));
navigate(url);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [window.location.search])
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [window.location.search]);

useEffect(() => {
const theme = localStorage.getItem('theme');
Expand Down

0 comments on commit 8569094

Please sign in to comment.