Skip to content
Snippets Groups Projects
Commit 28b8352f authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

chore: fix double alert on login failed

parent a01e377b
No related branches found
No related tags found
2 merge requests!124MEP,!121chore: fix double alert on login failed
...@@ -3,7 +3,6 @@ import { QueryClient, QueryClientProvider } from 'react-query' ...@@ -3,7 +3,6 @@ import { QueryClient, QueryClientProvider } from 'react-query'
import { BrowserRouter } from 'react-router-dom' import { BrowserRouter } from 'react-router-dom'
import { ToastContainer } from 'react-toastify' import { ToastContainer } from 'react-toastify'
import 'react-toastify/dist/ReactToastify.css' import 'react-toastify/dist/ReactToastify.css'
import Layout from './components/Layout/Layout'
import Router from './components/Routes/Router' import Router from './components/Routes/Router'
import { theme } from './components/UI/theme' import { theme } from './components/UI/theme'
...@@ -14,9 +13,7 @@ function App() { ...@@ -14,9 +13,7 @@ function App() {
<BrowserRouter> <BrowserRouter>
<ThemeProvider theme={theme}> <ThemeProvider theme={theme}>
<QueryClientProvider client={queryClient}> <QueryClientProvider client={queryClient}>
<Layout> <Router />
<Router />
</Layout>
<ToastContainer theme="colored" /> <ToastContainer theme="colored" />
</QueryClientProvider> </QueryClientProvider>
</ThemeProvider> </ThemeProvider>
......
import React from 'react'
import SideBar from '../SideBar/SideBar'
import styles from './layout.module.scss'
const Layout: React.FC = ({ children }) => {
return (
<div className={styles.root}>
<SideBar />
<main className={styles.wrapper}>{children}</main>
</div>
)
}
export default Layout
@import '../../styles/config/colors';
@import '../../styles/config/breakpoints';
.root {
display: flex;
background: $dark-bg;
height: 100vh;
}
.wrapper {
flex: 1;
box-shadow:
0px 5px 5px rgb(0 0 0 / 20%),
0px 3px 14px rgb(0 0 0 / 12%),
0px 8px 10px rgb(0 0 0 / 14%);
overflow-y: scroll;
@media screen and (max-width: $width-tablet) {
margin-left: 0;
padding-bottom: 5rem;
}
}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
.loader-container { .loader-container {
display: flex; display: flex;
height: 100%; height: 100%;
flex: 1;
overflow: hidden; overflow: hidden;
} }
.loader { .loader {
......
...@@ -6,6 +6,7 @@ import Login from '../Login/Login' ...@@ -6,6 +6,7 @@ import Login from '../Login/Login'
import Newsletter from '../Newsletter/Newsletter' import Newsletter from '../Newsletter/Newsletter'
import Popups from '../Popups/Popups' import Popups from '../Popups/Popups'
import Prices from '../Prices/Prices' import Prices from '../Prices/Prices'
import SideBar from '../SideBar/SideBar'
export const links: Record< export const links: Record<
string, string,
...@@ -43,21 +44,24 @@ const Router = () => { ...@@ -43,21 +44,24 @@ const Router = () => {
if (user) { if (user) {
return ( return (
<Routes> <>
<> <SideBar />
<Route path={links.newsletter.path} element={<Newsletter />} /> <main className="wrapper">
<Route path={links.prices.path} element={<Prices />} /> <Routes>
<Route path="/popups" element={<Popups />} /> <Route path={links.newsletter.path} element={<Newsletter />} />
{user.isAdmin && ( <Route path={links.prices.path} element={<Prices />} />
<Route path={links.consents.path} element={<Consents />} /> <Route path="/popups" element={<Popups />} />
)} {user.isAdmin && (
<Route path="/login" element={<Login />} /> <Route path={links.consents.path} element={<Consents />} />
<Route )}
path="*" <Route path="/login" element={<Login />} />
element={<Navigate replace to={links.newsletter.path} />} <Route
/> path="*"
</> element={<Navigate replace to={links.newsletter.path} />}
</Routes> />
</Routes>
</main>
</>
) )
} }
......
...@@ -9,6 +9,25 @@ ...@@ -9,6 +9,25 @@
color: $text-grey; color: $text-grey;
} }
#root {
display: flex;
background: $dark-bg;
height: 100vh;
}
.wrapper {
flex: 1;
box-shadow:
0px 5px 5px rgb(0 0 0 / 20%),
0px 3px 14px rgb(0 0 0 / 12%),
0px 8px 10px rgb(0 0 0 / 14%);
overflow-y: scroll;
@media screen and (max-width: $width-tablet) {
padding-bottom: 5rem;
}
}
h1 { h1 {
color: #fafafa; color: #fafafa;
@include text-large(); @include text-large();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment