diff options
Diffstat (limited to 'frontend')
| -rw-r--r-- | frontend/package-lock.json | 14 | ||||
| -rw-r--r-- | frontend/package.json | 1 | ||||
| -rw-r--r-- | frontend/src/components/login.js | 4 |
3 files changed, 18 insertions, 1 deletions
diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 0c4569a..9bfe340 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | "@testing-library/jest-dom": "^5.16.5", | 11 | "@testing-library/jest-dom": "^5.16.5", |
| 12 | "@testing-library/react": "^13.4.0", | 12 | "@testing-library/react": "^13.4.0", |
| 13 | "@testing-library/user-event": "^13.5.0", | 13 | "@testing-library/user-event": "^13.5.0", |
| 14 | "js-cookie": "^3.0.5", | ||
| 14 | "react": "^18.2.0", | 15 | "react": "^18.2.0", |
| 15 | "react-dom": "^18.2.0", | 16 | "react-dom": "^18.2.0", |
| 16 | "react-scripts": "5.0.1", | 17 | "react-scripts": "5.0.1", |
| @@ -11530,6 +11531,14 @@ | |||
| 11530 | "url": "https://github.com/chalk/supports-color?sponsor=1" | 11531 | "url": "https://github.com/chalk/supports-color?sponsor=1" |
| 11531 | } | 11532 | } |
| 11532 | }, | 11533 | }, |
| 11534 | "node_modules/js-cookie": { | ||
| 11535 | "version": "3.0.5", | ||
| 11536 | "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", | ||
| 11537 | "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==", | ||
| 11538 | "engines": { | ||
| 11539 | "node": ">=14" | ||
| 11540 | } | ||
| 11541 | }, | ||
| 11533 | "node_modules/js-sdsl": { | 11542 | "node_modules/js-sdsl": { |
| 11534 | "version": "4.3.0", | 11543 | "version": "4.3.0", |
| 11535 | "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", | 11544 | "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", |
| @@ -25457,6 +25466,11 @@ | |||
| 25457 | } | 25466 | } |
| 25458 | } | 25467 | } |
| 25459 | }, | 25468 | }, |
| 25469 | "js-cookie": { | ||
| 25470 | "version": "3.0.5", | ||
| 25471 | "resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-3.0.5.tgz", | ||
| 25472 | "integrity": "sha512-cEiJEAEoIbWfCZYKWhVwFuvPX1gETRYPw6LlaTKoxD3s2AkXzkCjnp6h0V77ozyqj0jakteJ4YqDJT830+lVGw==" | ||
| 25473 | }, | ||
| 25460 | "js-sdsl": { | 25474 | "js-sdsl": { |
| 25461 | "version": "4.3.0", | 25475 | "version": "4.3.0", |
| 25462 | "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", | 25476 | "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.3.0.tgz", |
diff --git a/frontend/package.json b/frontend/package.json index 123a434..72e2117 100644 --- a/frontend/package.json +++ b/frontend/package.json | |||
| @@ -6,6 +6,7 @@ | |||
| 6 | "@testing-library/jest-dom": "^5.16.5", | 6 | "@testing-library/jest-dom": "^5.16.5", |
| 7 | "@testing-library/react": "^13.4.0", | 7 | "@testing-library/react": "^13.4.0", |
| 8 | "@testing-library/user-event": "^13.5.0", | 8 | "@testing-library/user-event": "^13.5.0", |
| 9 | "js-cookie": "^3.0.5", | ||
| 9 | "react": "^18.2.0", | 10 | "react": "^18.2.0", |
| 10 | "react-dom": "^18.2.0", | 11 | "react-dom": "^18.2.0", |
| 11 | "react-scripts": "5.0.1", | 12 | "react-scripts": "5.0.1", |
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 ( |