main
Last change
on this file since c68150f was 702ca77, checked in by unknown <mlviktor23@…>, 2 years ago |
added current user/logout in header, display karma on user dashboard, started add post functionality in react
|
-
Property mode
set to
100644
|
File size:
486 bytes
|
Rev | Line | |
---|
[6eba109] | 1 | import React, { useContext } from "react";
|
---|
| 2 | import AuthApi from "../api/AuthApi";
|
---|
| 3 | import Cookies from "js-cookie";
|
---|
[702ca77] | 4 | import { LogoutButton } from "./Styled/UserDetails.style";
|
---|
| 5 | import { Navigate } from "react-router-dom";
|
---|
[6eba109] | 6 |
|
---|
| 7 | function Logout() {
|
---|
| 8 | const { auth, setAuth } = useContext(AuthApi);
|
---|
| 9 |
|
---|
| 10 | const handleLogout = () => {
|
---|
| 11 | setAuth(false);
|
---|
| 12 | Cookies.remove("JSESSIONID");
|
---|
| 13 | };
|
---|
| 14 |
|
---|
[702ca77] | 15 | return <LogoutButton onClick={handleLogout}>Одјави се</LogoutButton>;
|
---|
[6eba109] | 16 | }
|
---|
| 17 |
|
---|
| 18 | export default Logout;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.