|
@@ -21,7 +21,7 @@ export class Auth {
|
|
|
})
|
|
|
.then(() => BackendReturnStatus.Ok)
|
|
|
.catch((err) => {
|
|
|
- if (err.status === 401) return BackendReturnStatus.Unauthorized;
|
|
|
+ if (err.response.status === 401) return BackendReturnStatus.Unauthorized;
|
|
|
return BackendReturnStatus.Failure;
|
|
|
});
|
|
|
}
|
|
@@ -49,23 +49,25 @@ export class Auth {
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
return {
|
|
|
- status: err.status === 401 ? BackendReturnStatus.Unauthorized : BackendReturnStatus.Failure,
|
|
|
+ status: err.response.status === 401 ? BackendReturnStatus.Unauthorized : BackendReturnStatus.Failure,
|
|
|
user: DefaultUser,
|
|
|
};
|
|
|
});
|
|
|
}
|
|
|
|
|
|
- static async refreshRadarScopeKey(): Promise<boolean> {
|
|
|
+ static async refreshRadarScopeKey(): Promise<BackendReturnStatus> {
|
|
|
const token = Session.bearerToken();
|
|
|
- if (!token) return false;
|
|
|
+ if (!token) return BackendReturnStatus.Unauthorized;
|
|
|
|
|
|
return axios
|
|
|
- .get<void>(`${Configuration.resourceServer}/auth/refreshRadarScopeKey`, {
|
|
|
+ .patch<void>(`${Configuration.resourceServer}/auth/refreshRadarScopeKey`, {
|
|
|
headers: {
|
|
|
Authorization: `Bearer ${token}`,
|
|
|
},
|
|
|
})
|
|
|
- .then(() => true)
|
|
|
- .catch(() => false);
|
|
|
+ .then(() => BackendReturnStatus.Ok)
|
|
|
+ .catch((err) => {
|
|
|
+ return err.response.status === 401 ? BackendReturnStatus.Unauthorized : BackendReturnStatus.Failure;
|
|
|
+ });
|
|
|
}
|
|
|
}
|