logout fixes with role redirect
This commit is contained in:
@ -1,11 +1,15 @@
|
||||
export const withAuthRedirect = actionCall => (link, index) => {
|
||||
export const withAuthRedirect = actionCall => ({link, index, history, role}) => {
|
||||
return actionCall(link, index)
|
||||
.then(res => {
|
||||
if(res.status && res.status == 401) {
|
||||
localStorage.clear();
|
||||
history.push(role === 'ROLE_DEV' ? '/authdev' : '/auth')
|
||||
}
|
||||
|
||||
return res;
|
||||
})
|
||||
.catch(err => localStorage.clear())
|
||||
.catch(err => {
|
||||
localStorage.clear();
|
||||
history.push(role === 'ROLE_DEV' ? '/authdev' : '/auth');
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user