Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit ee5940d

Browse files
committed
fix(auth): handle invalid auth status
1 parent 06c8a8a commit ee5940d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

app/adapters/application.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,23 @@ import OIDCJSONAPIAdapter from "ember-simple-auth-oidc/adapters/oidc-json-api-ad
1616
*/
1717
export default class ApplicationAdapter extends OIDCJSONAPIAdapter {
1818
@service session;
19+
@service router;
1920

2021
namespace = "api/v1";
2122

2223
get headers() {
2324
return { ...this.session.headers };
2425
}
26+
27+
handleResponse(status, ...args) {
28+
if (status === 401) {
29+
if (this.session.isAuthenticated) {
30+
this.session.invalidate();
31+
} else {
32+
this.router.transitionTo("login");
33+
}
34+
}
35+
36+
return super.handleResponse(status, ...args);
37+
}
2538
}

0 commit comments

Comments
 (0)