-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from mamadou-niakate/feature/implement-context-api
Feature/implement context api
- Loading branch information
Showing
21 changed files
with
143 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,32 @@ | ||
import Home from '../src/component/Home/Home/Home'; | ||
import { | ||
Routes, | ||
Route, | ||
} from "react-router-dom"; | ||
import React, { createContext, useState } from 'react' | ||
import About from './component/Home/About/About'; | ||
import Dashboard from './component/Dashoboard/Dashboard/Dashboard'; | ||
import { getDecodedUser } from './component/Login/LoginManager'; | ||
import LoginModal from './component/Login/LoginModal'; | ||
import PrivateRoute from './component/Login/PrivateRoute'; | ||
import NotFound from './component/NotFound'; | ||
import Home from "../src/component/Home/Home/Home"; | ||
import { Routes, Route } from "react-router-dom"; | ||
import React, { createContext } from "react"; | ||
import About from "./component/Home/About/About"; | ||
import Dashboard from "./component/Dashoboard/Dashboard/Dashboard"; | ||
import LoginModal from "./component/Login/LoginModal"; | ||
import PrivateRoute from "./component/Login/PrivateRoute"; | ||
import NotFound from "./component/NotFound"; | ||
export const UserContext = createContext(); | ||
|
||
const App = () => { | ||
const [admin, setAdmin] = useState(false); | ||
const [selectedService, setSelectedService] = useState({}) | ||
const [user, setUser] = useState(getDecodedUser()) | ||
return ( | ||
<UserContext.Provider value={{ user, setUser, admin, setAdmin, selectedService, setSelectedService }}> | ||
<div> | ||
<Routes> | ||
<Route path="/" element={<Home />} /> | ||
<Route path="/about" element={<About />} /> | ||
<Route path="/login" element={<LoginModal />} /> | ||
<Route path="/dashboard/*" element={ | ||
<PrivateRoute redirectTo="/login"> | ||
<Dashboard /> | ||
</PrivateRoute> | ||
} | ||
/> | ||
<Route path="*" element={<NotFound/>}/> | ||
</Routes> | ||
</div> | ||
</UserContext.Provider> | ||
) | ||
} | ||
|
||
export default App | ||
<div> | ||
<Routes> | ||
<Route path="/" element={<Home />} /> | ||
<Route path="/about" element={<About />} /> | ||
<Route path="/login" element={<LoginModal />} /> | ||
<Route | ||
path="/dashboard/*" | ||
element={ | ||
<PrivateRoute redirectTo="/login"> | ||
<Dashboard /> | ||
</PrivateRoute> | ||
} | ||
/> | ||
<Route path="*" element={<NotFound />} /> | ||
</Routes> | ||
</div> | ||
); | ||
}; | ||
|
||
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/component/Dashoboard/UserDashboard/AddReview/ReviewFrom.jsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.