66import SimpleAuthBaseAuthenticator from 'ember-simple-auth/authenticators/base' ;
77import { resolve , reject } from 'rsvp' ;
88import { waitForPromise } from '@ember/test-waiters' ;
9- import { service } from '@ember/service' ;
109
1110/**
1211 * Encapsulates common authenticator functionality.
@@ -20,10 +19,6 @@ import { service } from '@ember/service';
2019 * All other responses should resolve the session restoration successfully.
2120 */
2221export default class BaseAuthenticator extends SimpleAuthBaseAuthenticator {
23- // =services
24-
25- @service store ;
26-
2722 // =unimplemented methods
2823
2924 /**
@@ -56,6 +51,14 @@ export default class BaseAuthenticator extends SimpleAuthBaseAuthenticator {
5651 */
5752 buildTokenValidationEndpointURL ( /* tokenID */ ) { }
5853
54+ /**
55+ * Generates an account URL used to retrieve authenticated account.
56+ * @override
57+ * @param {string } accountID
58+ * @return {string }
59+ */
60+ buildAccountEndpointURL ( /* accountID */ ) { }
61+
5962 // =methods
6063
6164 /**
@@ -116,15 +119,12 @@ export default class BaseAuthenticator extends SimpleAuthBaseAuthenticator {
116119 data . isOrg = data ?. scope ?. type === 'org' ;
117120
118121 try {
119- const adapter = this . store . adapterFor ( 'application' ) ;
120- const findAccountRecordURL = adapter . buildURL (
121- 'account' ,
122+ const accountFindRecordURL = this . buildAccountEndpointURL (
122123 data ?. account_id ,
123- { } ,
124- 'findRecord' ,
125124 ) ;
125+
126126 const response = await waitForPromise (
127- fetch ( findAccountRecordURL , {
127+ fetch ( accountFindRecordURL , {
128128 method : 'get' ,
129129 headers : { Authorization : `Bearer ${ data . attributes . token } ` } ,
130130 } ) ,
0 commit comments