source: reactapp/src/Components/Logout.js@ c68150f

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
Line 
1import React, { useContext } from "react";
2import AuthApi from "../api/AuthApi";
3import Cookies from "js-cookie";
4import { LogoutButton } from "./Styled/UserDetails.style";
5import { Navigate } from "react-router-dom";
6
7function 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
18export default Logout;
Note: See TracBrowser for help on using the repository browser.