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 | |
---|
1 | import React, { useContext } from "react";
|
---|
2 | import AuthApi from "../api/AuthApi";
|
---|
3 | import Cookies from "js-cookie";
|
---|
4 |
|
---|
5 | function 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 |
|
---|
16 | export default Logout;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.