Commit bcd4546f authored by 2breakegg's avatar 2breakegg

log out

parent ad3f621b
This diff is collapsed.
...@@ -21,10 +21,9 @@ export default { ...@@ -21,10 +21,9 @@ export default {
register: {}, register: {},
}, },
reducers: { reducers: {
signOut(state){ signOut(state) {
console.log('sign out');
localStorage.removeItem('token'); localStorage.removeItem('token');
localStorage.removeItem('user'); location='/';
return state; return state;
}, },
change(state, action) { change(state, action) {
......
...@@ -29,5 +29,4 @@ function mapStateToProps(state) { ...@@ -29,5 +29,4 @@ function mapStateToProps(state) {
loading, loading,
}; };
} }
export default connect(mapStateToProps)(Active); export default connect(mapStateToProps)(Active);
...@@ -151,11 +151,11 @@ function Index({ children, messages, dispatch }) { ...@@ -151,11 +151,11 @@ function Index({ children, messages, dispatch }) {
defaultSelectedKeys={['1']} defaultSelectedKeys={['1']}
style={{ lineHeight: '64px', position: 'absolute', right: '50px' }} 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' }) }}> <div onClick={() => { dispatch({ type : 'auth/signOut' }) }}>
<Format id="sign-out"/> <Format id="sign-out"/>
</div> </div>
</Menu.Item>):(<div></div>) </Menu.Item>):('')
} }
</Menu> </Menu>
</Header> </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