small works
Some checks failed
CI / Lint (push) Failing after 7m46s
CI / Test (push) Failing after 8m24s

This commit is contained in:
2025-04-04 18:21:37 +02:00
parent 211393728d
commit 0b29bc2d44
7 changed files with 297 additions and 31 deletions

View File

@@ -5,14 +5,21 @@ import { inject as service } from '@ember/service';
export default class ApplicationAdapter extends JSONAPIAdapter {
@service session;
namespace = 'api/v1';
get namespace() {
if (this.session.isAuthenticated) {
return 'api/v1';
} else {
return 'api/v1/public';
}
}
@computed('session.{data.authenticated.access_token,isAuthenticated}')
get headers() {
let headers = {};
if (this.session.isAuthenticated) {
// OAuth 2
headers['Authorization'] = `Bearer ${this.session.data.authenticated.access_token}`;
headers['Authorization'] =
`Bearer ${this.session.data.authenticated.access_token}`;
}
return headers;