Commit bcd4546f authored by 2breakegg's avatar 2breakegg

log out

parent ad3f621b
This diff is collapsed.
......@@ -21,10 +21,9 @@ export default {
register: {},
},
reducers: {
signOut(state){
console.log('sign out');
signOut(state) {
localStorage.removeItem('token');
localStorage.removeItem('user');
location='/';
return state;
},
change(state, action) {
......
......@@ -29,5 +29,4 @@ function mapStateToProps(state) {
loading,
};
}
export default connect(mapStateToProps)(Active);
......@@ -151,11 +151,11 @@ function Index({ children, messages, dispatch }) {
defaultSelectedKeys={['1']}
style={{ lineHeight: '64px', position: 'absolute', right: '50px' }}
>
{localStorage.getItem('user') ? (<Menu.Item key="1">
{localStorage.getItem('token') ? (<Menu.Item key="1">
<div onClick={() => { dispatch({ type : 'auth/signOut' }) }}>
<Format id="sign-out"/>
</div>
</Menu.Item>):(<div></div>)
</Menu.Item>):('')
}
</Menu>
</Header>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment