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 917501f commit cc3962b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
22 changes: 11 additions & 11 deletions src/layouts/base.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ export default function BaseLayout() {
const [isDark, setDark] = useState(false);
const navigate = useNavigate();

useEffect(() => {
if (window.location.search) {
const params = new URLSearchParams(window.location.search);
const uri = params.get('uri');
if (uri) {
const url = decodeURIComponent(encodeURIComponent(uri));
navigate(new URL(url)?.pathname);
}
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [window.location.search]);
// useEffect(() => {
// if (window.location.search) {
// const params = new URLSearchParams(window.location.search);
// const uri = params.get('uri');
// if (uri) {
// const url = decodeURIComponent(encodeURIComponent(uri));
// navigate(new URL(url)?.pathname);
// }
// }
// // eslint-disable-next-line react-hooks/exhaustive-deps
// }, [window.location.search]);

useEffect(() => {
const theme = localStorage.getItem('theme');
Expand Down
6 changes: 3 additions & 3 deletions src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { HashRouter } from 'react-router-dom';

import BaseLayout from '@/layouts/base';
import './index.css';

ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<BrowserRouter basename="/gpthub/">
<HashRouter>
<BaseLayout />
</BrowserRouter>
</HashRouter>
</React.StrictMode>,
)

0 comments on commit cc3962b

Please sign in to comment.