main
Last change
on this file since 8dffe02 was 9bf1f8d, checked in by viktor <viktor@…>, 21 months ago |
prefinal
|
-
Property mode
set to
100644
|
File size:
465 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 |
|
---|
6 | function Logout() {
|
---|
7 | const { auth, setAuth } = useContext(AuthApi);
|
---|
8 |
|
---|
9 | const handleLogout = () => {
|
---|
10 | setAuth(false);
|
---|
11 | Cookies.remove("JSESSIONID");
|
---|
12 | };
|
---|
13 |
|
---|
14 | return <LogoutButton onClick={handleLogout} style={{color:"black"}}>Одјави се</LogoutButton>;
|
---|
15 | }
|
---|
16 |
|
---|
17 | export default Logout;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.