Skip to content

Commit

Permalink
Merge pull request #29 from mykhalenych/bugfix/routing-refresh-page
Browse files Browse the repository at this point in the history
bugfix/routing-refresh-page add BrowserRouter to index.tsx
  • Loading branch information
mykhalenych authored Jul 6, 2023
2 parents 2bf89de + 3ba0dfb commit f5c5239
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 70 deletions.
136 changes: 67 additions & 69 deletions src/Routes/Routes.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import {BrowserRouter as Router, Route, Routes as RootRoutes} from 'react-router-dom';
import {Route, Routes as RootRoutes} from 'react-router-dom';

import MainLayout from '../layouts/MainLayout';
import {
Expand Down Expand Up @@ -28,74 +28,72 @@ import ProtectedRoute from '../components/routes/ProtectedRoute';

const Routes: React.FC = () => {
return (
<Router>
<RootRoutes>
<Route path={AUTH_PATH} element={<AuthLayout />}>
<Route
path={LOGIN_PATH}
element={
<PublicRoute>
<Login />
</PublicRoute>
}
/>
<Route
path={SIGN_IN_PATH}
element={
<PublicRoute>
<SignIn />
</PublicRoute>
}
/>
<Route
path={FORGOT_PATH}
element={
<PublicRoute>
<ForgotPassword />
</PublicRoute>
}
/>
<Route
path={CHECK_EMAIL_PATH}
element={
<PublicRoute>
<CheckEmail />
</PublicRoute>
}
/>
<Route
path={ACTIVATION_PATH}
element={
<PublicRoute>
<Activation />
</PublicRoute>
}
/>
<Route
path={RESET_PASSWORD_PATH}
element={
<PublicRoute>
<RecoveryPassword />
</PublicRoute>
}
/>
</Route>
<Route path={PROFILE_PATH} element={<AuthLayout />}>
<Route
index
element={
<ProtectedRoute>
<Profile />
</ProtectedRoute>
}
/>
</Route>
<Route path="/" element={<MainLayout />}>
<Route path={'/'} element={<Main />} />
<Route path={PLAN_PATH} element={<Plan />} />
</Route>
</RootRoutes>
</Router>
<RootRoutes>
<Route path={AUTH_PATH} element={<AuthLayout />}>
<Route
path={LOGIN_PATH}
element={
<PublicRoute>
<Login />
</PublicRoute>
}
/>
<Route
path={SIGN_IN_PATH}
element={
<PublicRoute>
<SignIn />
</PublicRoute>
}
/>
<Route
path={FORGOT_PATH}
element={
<PublicRoute>
<ForgotPassword />
</PublicRoute>
}
/>
<Route
path={CHECK_EMAIL_PATH}
element={
<PublicRoute>
<CheckEmail />
</PublicRoute>
}
/>
<Route
path={ACTIVATION_PATH}
element={
<PublicRoute>
<Activation />
</PublicRoute>
}
/>
<Route
path={RESET_PASSWORD_PATH}
element={
<PublicRoute>
<RecoveryPassword />
</PublicRoute>
}
/>
</Route>
<Route path={PROFILE_PATH} element={<AuthLayout />}>
<Route
index
element={
<ProtectedRoute>
<Profile />
</ProtectedRoute>
}
/>
</Route>
<Route path="/" element={<MainLayout />}>
<Route path={'/'} element={<Main />} />
<Route path={PLAN_PATH} element={<Plan />} />
</Route>
</RootRoutes>
);
};

Expand Down
7 changes: 6 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import {HashRouter} from 'react-router-dom';

import App from './App';
import './styles.css';

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement);
root.render(<App />);
root.render(
<HashRouter>
<App />
</HashRouter>,
);

0 comments on commit f5c5239

Please sign in to comment.