|
@@ -1,12 +1,14 @@
|
1
|
1
|
import React from "react";
|
2
|
2
|
import { Link } from "react-router-dom";
|
3
|
|
-import Cookies from "js-cookie";
|
|
3
|
+import { useSelector } from "react-redux";
|
4
|
4
|
|
5
|
5
|
import "./index.scss";
|
6
|
6
|
import Star from "../../assets/img/star.ico";
|
7
|
7
|
import LogoutButton from "../buttons/LogoutButton";
|
8
|
8
|
|
9
|
9
|
const Navbar = () => {
|
|
10
|
+ const currentUser = useSelector((state) => state.currentUser);
|
|
11
|
+
|
10
|
12
|
return (
|
11
|
13
|
<div className="navbar">
|
12
|
14
|
<div className="navbar__LeftSide">
|
|
@@ -22,14 +24,22 @@ const Navbar = () => {
|
22
|
24
|
</Link>
|
23
|
25
|
</div>
|
24
|
26
|
<div className="navbar__RightSide">
|
25
|
|
- <Link to="/signup">
|
26
|
|
- <button>S'inscrire</button>
|
27
|
|
- </Link>
|
28
|
|
- <Link to="/login">
|
29
|
|
- <button>Se connecter</button>
|
30
|
|
- </Link>
|
31
|
|
- <button>Profil</button>
|
32
|
|
- <LogoutButton />
|
|
27
|
+ {!currentUser && (
|
|
28
|
+ <>
|
|
29
|
+ <Link to="/signup">
|
|
30
|
+ <button>S'inscrire</button>
|
|
31
|
+ </Link>
|
|
32
|
+ <Link to="/login">
|
|
33
|
+ <button>Se connecter</button>
|
|
34
|
+ </Link>
|
|
35
|
+ </>
|
|
36
|
+ )}
|
|
37
|
+ {currentUser && (
|
|
38
|
+ <>
|
|
39
|
+ <button>Profil</button>
|
|
40
|
+ <LogoutButton />
|
|
41
|
+ </>
|
|
42
|
+ )}
|
33
|
43
|
</div>
|
34
|
44
|
</div>
|
35
|
45
|
);
|