source: reactapp/src/Components/Logout.js@ 6eba109

main
Last change on this file since 6eba109 was 6eba109, checked in by unknown <mlviktor23@…>, 23 months ago

implemented authentication in react

  • Property mode set to 100644
File size: 370 bytes
Line 
1import React, { useContext } from "react";
2import AuthApi from "../api/AuthApi";
3import Cookies from "js-cookie";
4
5function Logout() {
6 const { auth, setAuth } = useContext(AuthApi);
7
8 const handleLogout = () => {
9 setAuth(false);
10 Cookies.remove("JSESSIONID");
11 };
12
13 return <button onClick={handleLogout}>Одјави се</button>;
14}
15
16export default Logout;
Note: See TracBrowser for help on using the repository browser.