Skip to content
Snippets Groups Projects
Commit b291ca57 authored by Lucas Eduardo Schoenfelder's avatar Lucas Eduardo Schoenfelder
Browse files

fixed logout button

parent 8b307125
Branches
Tags
4 merge requests!57Merge of develop into master,!56Fixed buttons reportar, seguir, compartilhar, guardar and entrar (in comments...,!39Update admin system,!32Homologa
......@@ -28,7 +28,9 @@ import { Store } from '../Store';
import { Redirect } from "react-router-dom";
import Profile from '../img/default_profile0.png'
import styled from 'styled-components'
import {apiDomain} from '../env.js'
import {apiDomain, apiUrl} from '../env.js'
import {getAxiosConfig} from './HelperFunctions/getAxiosConfig'
import axios from 'axios'
const iconStyles = {
fontSize : "xxx-large",
......@@ -56,6 +58,10 @@ export default function MenuList(props) {
};
const handleLogout = () => {
let config = getAxiosConfig()
axios.delete(`${apiUrl}/auth/sign_out`, config).then(
(res) => {
localStorage.removeItem('@portalmec/username');
sessionStorage.removeItem('@portalmec/uid');
sessionStorage.removeItem('@portalmec/senha');
......@@ -68,8 +74,13 @@ export default function MenuList(props) {
accessToken : '',
client : ''
}
})
},
(err) => {
console.log(err)
}
)
}
return (
......
......@@ -31,13 +31,15 @@ import ExitToAppIcon from '@material-ui/icons/ExitToApp'
import { Button } from '@material-ui/core';
import MenuItem from '@material-ui/core/MenuItem';
import DefaultAvatar from '../img/default_profile0.png'
import {apiDomain} from '../env.js'
import CloudUploadIcon from '@material-ui/icons/CloudUpload';
import CloudDoneIcon from '@material-ui/icons/CloudDone';
import HistoryIcon from '@material-ui/icons/History';
import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder';
import FolderOpenIcon from '@material-ui/icons/FolderOpen';
import SettingsIcon from '@material-ui/icons/Settings';
import {apiDomain, apiUrl} from '../env.js'
import {getAxiosConfig} from './HelperFunctions/getAxiosConfig'
import axios from 'axios'
export default function MobileDrawerMenu (props) {
const {state, dispatch} = useContext(Store)
......@@ -76,7 +78,11 @@ export default function MobileDrawerMenu (props) {
{/*dispatches log out actions to Store.js*/}
const handleLogout = () => {
sessionStorage.removeItem('@portalmec/username');
let config = getAxiosConfig()
axios.delete(`${apiUrl}/auth/sign_out`, config).then(
(res) => {
localStorage.removeItem('@portalmec/username');
sessionStorage.removeItem('@portalmec/uid');
sessionStorage.removeItem('@portalmec/senha');
dispatch( {
......@@ -88,6 +94,10 @@ export default function MobileDrawerMenu (props) {
accessToken : '',
client : ''
}
})
},
(err) => {
console.log(err)
}
)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment