File tree Expand file tree Collapse file tree 5 files changed +58
-2
lines changed Expand file tree Collapse file tree 5 files changed +58
-2
lines changed Original file line number Diff line number Diff line change
1
+ import "../style/Links.css" ;
2
+
3
+
4
+ function Links ( ) {
5
+
6
+ function handleClickInventory ( ) {
7
+ window . location . href = '/inventory' ;
8
+ }
9
+ function handleClickPortfolio ( ) {
10
+ window . location . href = '/portfolio' ;
11
+ }
12
+
13
+ return (
14
+ < >
15
+ < div className = "links-wrapper" >
16
+ < div className = "link" onClick = { handleClickInventory } >
17
+ < h2 > Inventaire</ h2 >
18
+ </ div >
19
+
20
+ < div className = "link" onClick = { handleClickPortfolio } >
21
+ < h2 > Historique des évennements</ h2 >
22
+ </ div >
23
+
24
+ </ div >
25
+ </ >
26
+ ) ;
27
+ }
28
+
29
+ export default Links ;
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ function LogoutButton() {
26
26
}
27
27
// Supprimer le token du local storage
28
28
localStorage . removeItem ( 'token' ) ;
29
- localStorage . removeItem ( 'user_id' ) ;
29
+ sessionStorage . removeItem ( 'user_id' ) ;
30
30
setUserId ( - 1 ) ;
31
31
setIsAuthenticated ( false ) ;
32
32
// window.location.href = '/login';
Original file line number Diff line number Diff line change @@ -5,13 +5,14 @@ export const UserContext = createContext();
5
5
6
6
export const UserProvider = ( { children } ) => {
7
7
const [ isLoading , setIsLoading ] = useState ( true ) ;
8
- const [ userId , setUserId ] = useState ( 1 ) ;
8
+ const [ userId , setUserId ] = useState ( - 1 ) ;
9
9
10
10
useEffect ( ( ) => {
11
11
const token = localStorage . getItem ( 'token' ) ;
12
12
const user_id = sessionStorage . getItem ( 'user_id' ) ;
13
13
if ( user_id ) {
14
14
setUserId ( user_id ) ;
15
+ console . log ( user_id )
15
16
setIsLoading ( false ) ;
16
17
} else if ( token ) {
17
18
getUserId ( token ) . then ( ( valid ) => {
Original file line number Diff line number Diff line change @@ -2,13 +2,15 @@ import Footer from "../components/Footer"
2
2
import Son from "../components/Son.jsx" ;
3
3
import Main from "../components/Main" ;
4
4
import Desc from "../components/Desc"
5
+ import Links from "../components/Links"
5
6
import Lights from "../components/Lights" ;
6
7
7
8
8
9
function Site ( ) {
9
10
return (
10
11
< >
11
12
< Main />
13
+ { /*<Links/>*/ }
12
14
< Desc />
13
15
< Son />
14
16
< Lights />
Original file line number Diff line number Diff line change
1
+ .links-wrapper {
2
+ width : 100vw ;
3
+ height : 10vh ;
4
+ display : flex;
5
+ flex-direction : row;
6
+ flex-wrap : wrap;
7
+ justify-content : center;
8
+ margin-bottom : 10vh ;
9
+ }
10
+
11
+ .links-wrapper > div {
12
+ color : white;
13
+ margin : 2% ;
14
+ padding : 1% ;
15
+ border-radius : 7px ;
16
+ background-color : black;
17
+ border-color : white;
18
+ border-width : 10px ;
19
+ height : auto;
20
+ }
21
+
22
+ .link : hover {
23
+ cursor : pointer;
24
+ }
You can’t perform that action at this time.
0 commit comments