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

Last change on this file since ebc5176 was ebc5176, checked in by unknown <mlviktor23@…>, 2 years ago

prototip

  • Property mode set to 100644
File size: 486 bytes
RevLine 
[ebc5176]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.