main
Last change
on this file since a5aba17 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
|
Line | |
---|
1 | import React, { useContext } from "react";
|
---|
2 | import AuthApi from "../api/AuthApi";
|
---|
3 | import Cookies from "js-cookie";
|
---|
4 | import { LogoutButton } from "./Styled/UserDetails.style";
|
---|
5 | import { Navigate } from "react-router-dom";
|
---|
6 |
|
---|
7 | function Logout() {
|
---|
8 | const { auth, setAuth } = useContext(AuthApi);
|
---|
9 |
|
---|
10 | const handleLogout = () => {
|
---|
11 | setAuth(false);
|
---|
12 | Cookies.remove("JSESSIONID");
|
---|
13 | };
|
---|
14 |
|
---|
15 | return <LogoutButton onClick={handleLogout}>Одјави се</LogoutButton>;
|
---|
16 | }
|
---|
17 |
|
---|
18 | export default Logout;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.