work on jwt auth
Some checks failed
CI / Lint (push) Failing after 14m49s
CI / Test (push) Failing after 7m55s

This commit is contained in:
2025-01-08 16:49:27 +01:00
parent cf15e3beb3
commit feef600052
14 changed files with 103 additions and 18 deletions

View File

@@ -5,6 +5,8 @@ import { inject as service } from '@ember/service';
export default class ApplicationAdapter extends JSONAPIAdapter {
@service session;
namespace = 'api/v1';
@computed('session.{data.authenticated.access_token,isAuthenticated}')
get headers() {
let headers = {};
@@ -15,4 +17,10 @@ export default class ApplicationAdapter extends JSONAPIAdapter {
return headers;
}
handleResponse(status) {
if (status === 401 && this.session.isAuthenticated) {
this.session.invalidate();
}
}
}