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
|
Rev | Line | |
---|
[6eba109] | 1 | import React, { useContext } from "react";
|
---|
| 2 | import AuthApi from "../api/AuthApi";
|
---|
| 3 | import Cookies from "js-cookie";
|
---|
[702ca77] | 4 | import { LogoutButton } from "./Styled/UserDetails.style";
|
---|
[6eba109] | 5 |
|
---|
| 6 | function Logout() {
|
---|
| 7 | const { auth, setAuth } = useContext(AuthApi);
|
---|
| 8 |
|
---|
| 9 | const handleLogout = () => {
|
---|
| 10 | setAuth(false);
|
---|
| 11 | Cookies.remove("JSESSIONID");
|
---|
| 12 | };
|
---|
| 13 |
|
---|
[9bf1f8d] | 14 | return <LogoutButton onClick={handleLogout} style={{color:"black"}}>Одјави се</LogoutButton>;
|
---|
[6eba109] | 15 | }
|
---|
| 16 |
|
---|
| 17 | export default Logout;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.