work on jwt auth
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user