diff options
Diffstat (limited to 'frontend/src/components')
| -rw-r--r-- | frontend/src/components/login.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/frontend/src/components/login.js b/frontend/src/components/login.js index 558bc8f..8dea383 100644 --- a/frontend/src/components/login.js +++ b/frontend/src/components/login.js | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | import React from 'react'; | 1 | import React from 'react'; |
| 2 | import { Link } from "react-router-dom"; | 2 | import { Link } from "react-router-dom"; |
| 3 | import Cookies from 'js-cookie'; | ||
| 3 | 4 | ||
| 4 | import "./login.css"; | 5 | import "./login.css"; |
| 5 | import img1 from "../imgs/login.png" | 6 | import img1 from "../imgs/login.png" |
| @@ -13,6 +14,7 @@ function login() { | |||
| 13 | window.location.href="https://lp.ardapektezol.com/api/v1/login" | 14 | window.location.href="https://lp.ardapektezol.com/api/v1/login" |
| 14 | } | 15 | } |
| 15 | function logout() { | 16 | function logout() { |
| 17 | Cookies.remove('token') | ||
| 16 | setToken(null) | 18 | setToken(null) |
| 17 | window.location.href="/" | 19 | window.location.href="/" |
| 18 | } | 20 | } |
| @@ -36,7 +38,7 @@ React.useEffect(() => { | |||
| 36 | }}) | 38 | }}) |
| 37 | .then(r => r.json()) | 39 | .then(r => r.json()) |
| 38 | .then(d => {setProfile(d);console.log(d)}) | 40 | .then(d => {setProfile(d);console.log(d)}) |
| 39 | }, []); | 41 | }, [token]); |
| 40 | 42 | ||
| 41 | 43 | ||
| 42 | return ( | 44 | return ( |