source: reactapp/src/Components/Logout.js@ 8d83180

main
Last change on this file since 8d83180 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.