fix issue with authentication redirect loop
This commit is contained in:
@ -47,7 +47,7 @@ export function redirectingAuthorizedFetch(url, params) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
authorizedFetch(url, params).then(response => {
|
||||
if (response.status === 401) {
|
||||
history.push("/");
|
||||
history.push("/unauthorized");
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
|
@ -89,11 +89,11 @@ class AuthenticationWrapper extends React.Component {
|
||||
|
||||
signIn = (accessToken) => {
|
||||
try {
|
||||
this.setState({ context: { ...this.state.context, user: jwtDecode(accessToken) } });
|
||||
localStorage.setItem(ACCESS_TOKEN, accessToken);
|
||||
this.setState({ context: { ...this.state.context, user: jwtDecode(accessToken) } });
|
||||
} catch (err) {
|
||||
this.setState({ initialized: true, context: { ...this.state.context, user: undefined } });
|
||||
this.props.raiseNotification("Failed to parse JWT " + err.message);
|
||||
throw new Error("Failed to parse JWT " + err.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user