unknown 3 lat temu
rodzic
commit
4aa3481da4

Plik diff jest za duży
+ 1 - 1
.eslintcache


+ 1 - 1
src/App.module.css

@@ -1,5 +1,5 @@
 .appWrapper {
   min-width: 100vw;
   min-height: 100vh;
-  background-color: rgb(187, 187, 187);
+  background-color: rgb(119, 110, 110);
 }

+ 56 - 48
src/App.tsx

@@ -1,4 +1,4 @@
-import { lazy } from 'react';
+import { lazy, Suspense } from 'react';
 import { BrowserRouter, Switch, Route } from 'react-router-dom';
 import { connect } from 'react-redux';
 import { ToastContainer } from 'react-toastify';
@@ -8,6 +8,7 @@ import { IAppProps, IAppState } from './typescript/app/interfaces';
 
 import PrivateRoute from './components/Routes/PrivateRoute/PrivateRoute';
 import PublicRoute from './components/Routes/PublicRoute/PublicRoute';
+import Loader from './components/Loader/Loader';
 
 const Navigation = lazy(
   () =>
@@ -66,56 +67,63 @@ const RegistrationForm = lazy(
     ),
 );
 
-const Loader = lazy(
-  () => import('./components/Loader/Loader' /* webpackChunkName: "Loader" */),
-);
-
 function App({ isLoading }: IAppProps) {
   return (
     <div className={s.appWrapper}>
-      <BrowserRouter>
-        <Switch>
-          <PrivateRoute path="/">
-            <Navigation />
-          </PrivateRoute>
-          <PrivateRoute exact path="/categories">
-            <Categories />
-          </PrivateRoute>
-          <PrivateRoute exact path="/categories/goods/:name">
-            <Goods />
-          </PrivateRoute>
-          <PrivateRoute exact path="/categories/goods/:name/:id">
-            <DetailGood />
-          </PrivateRoute>
-          <PrivateRoute exact path="/orders">
-            <Orders />
-          </PrivateRoute>
-          <PrivateRoute path="/orders/:id">
-            <DetailOrder />
-          </PrivateRoute>
-          <PublicRoute exact path={'/authorization'} restricted>
-            <Goods />
-            {/* <PublicRoute exact path={'/authorization/login'} restricted>
-                 <SignInForm />
-               </PublicRoute>
-               <PublicRoute exact path={'/authorization/registration'} restricted>
-                 <RegistrationForm />
-               </PublicRoute> */}
-          </PublicRoute>
-        </Switch>
-        {isLoading && <Loader />}
-        <ToastContainer
-          position="top-right"
-          autoClose={3000}
-          hideProgressBar={false}
-          newestOnTop={false}
-          closeOnClick
-          rtl={false}
-          pauseOnFocusLoss
-          draggable
-          pauseOnHover
-        />
-      </BrowserRouter>
+      <Suspense fallback={<Loader />}>
+        <BrowserRouter>
+          <Switch>
+            <Route path={'/authorization'}>
+              <Authorization />
+              <PublicRoute exact path={'/authorization/login'} restricted>
+                <SignInForm />
+              </PublicRoute>
+              <PublicRoute
+                exact
+                path={'/authorization/registration'}
+                restricted
+              >
+                <RegistrationForm />
+              </PublicRoute>
+            </Route>
+            <PrivateRoute path="/">
+              <Navigation />
+            </PrivateRoute>
+            <PrivateRoute exact path="/categories">
+              <Navigation />
+              <Categories />
+            </PrivateRoute>
+            <PrivateRoute exact path="/categories/goods/:name">
+              <Navigation />
+              <Goods />
+            </PrivateRoute>
+            <PrivateRoute exact path="/categories/goods/:name/:id">
+              <Navigation />
+              <DetailGood />
+            </PrivateRoute>
+            <PrivateRoute exact path="/orders">
+              <Navigation />
+              <Orders />
+            </PrivateRoute>
+            <PrivateRoute path="/orders/:id">
+              <Navigation />
+              <DetailOrder />
+            </PrivateRoute>
+          </Switch>
+          {isLoading && <Loader />}
+          <ToastContainer
+            position="top-right"
+            autoClose={3000}
+            hideProgressBar={false}
+            newestOnTop={false}
+            closeOnClick
+            rtl={false}
+            pauseOnFocusLoss
+            draggable
+            pauseOnHover
+          />
+        </BrowserRouter>
+      </Suspense>
     </div>
   );
 }

+ 1 - 1
src/components/Routes/PrivateRoute/PrivateRoute.tsx

@@ -9,7 +9,7 @@ import {
 function PrivateRoute({ children, token, ...routeProps }: IPrivateProps) {
   return (
     <Route {...routeProps}>
-      {token ? children : <Redirect to="/authorization" />}
+      {true ? children : <Redirect to="/authorization" />}
     </Route>
   );
 }

+ 4 - 6
src/index.tsx

@@ -1,4 +1,4 @@
-import React, { Suspense } from 'react';
+import React from 'react';
 import { Provider } from 'react-redux';
 import ReactDOM from 'react-dom';
 import 'react-toastify/dist/ReactToastify.css';
@@ -10,11 +10,9 @@ import { store } from './redux/store';
 
 ReactDOM.render(
   <React.StrictMode>
-    <Suspense fallback={null}>
-      <Provider store={store}>
-        <App />
-      </Provider>
-    </Suspense>
+    <Provider store={store}>
+      <App />
+    </Provider>
   </React.StrictMode>,
   document.getElementById('root'),
 );

+ 1 - 1
src/redux/authorization/action/index.ts

@@ -7,7 +7,7 @@ const actionLoginSuccess = (payload: IAuthorizationPayload) => ({
 });
 
 const actionLoginReject = () => ({
-  type: authorizationActionType.logoutReject,
+  type: authorizationActionType.loginReject,
   payload: {},
 });