When sending an invalid token, the HTTP API from the Pusher now returns a 401 instead of an HTTP 500.
This commit is contained in:
parent
ff77a18262
commit
598c7412a2
2 changed files with 14 additions and 8 deletions
|
@ -116,11 +116,12 @@ export class Room {
|
|||
this._contactPage = data.contactPage || CONTACT_URL;
|
||||
return new MapDetail(data.mapUrl, data.textures);
|
||||
} catch (e) {
|
||||
console.error("Error => getMapDetail", e, e.response);
|
||||
//TODO fix me and manage Error class
|
||||
if (e.response?.data === "Token decrypted error") {
|
||||
if (axios.isAxiosError(e) && e.response?.status == 401 && e.response?.data === "Token decrypted error") {
|
||||
console.warn("JWT token sent could not be decrypted. Maybe it expired?");
|
||||
localUserStore.setAuthToken(null);
|
||||
window.location.assign("/login");
|
||||
} else {
|
||||
console.error("Error => getMapDetail", e, e.response);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue