Skip to content

Commit

Permalink
добавляет компоненту карты, стор для авторизации, разделение на прива…
Browse files Browse the repository at this point in the history
…тные и публичные пути
  • Loading branch information
semant1cs committed Nov 7, 2023
1 parent fba6073 commit 7a472dc
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
11 changes: 11 additions & 0 deletions frontend/src/components/MapMenu/MapMenu.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React from 'react';

const MapMenu: React.FC = () => {
return (
<div>

</div>
);
};

export default MapMenu;
26 changes: 25 additions & 1 deletion frontend/src/routes/AppRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react';
import React, {useState} from 'react';
import {RouteType} from "../types/RouteType.ts";
import WelcomePage from "../components/welcomePage/WelcomePage.tsx";
import {Route, Routes} from "react-router-dom";
import Authentication from "../components/authentication/Authentication.tsx";
import MapMenu from "../components/MapMenu/MapMenu.tsx";

const AppRouter: React.FC = () => {
const publicRoutes: RouteType[] = [
Expand All @@ -17,9 +18,32 @@ const AppRouter: React.FC = () => {
element: <Authentication/>
}
]

const privateRoutes: RouteType[] = [
{
id: "1",
path: '/',
element: <WelcomePage/>
},
{
id: "2",
path: 'authentication',
element: <Authentication/>
},
{
id: "3",
path: 'map',
element: <MapMenu/>
}
]

return (
<div>
<Routes>
{isUserAuthorized
? privateRoutes.map(({path, element, id}) => <Route path={path} element={element} id={id}/>)
: publicRoutes.map(({path, element, id}) => <Route path={path} element={element} id={id}/>)
}
{publicRoutes.map(({path, element, id}) => <Route path={path} element={element} id={id}/>)}
</Routes>
</div>
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/store/authStore.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {observer} from "mobx"
class AuthStore {

}

export default new AuthStore()

0 comments on commit 7a472dc

Please sign in to comment.