fix: 🐛 proxy promise deprecation (#1851)
* fix: 🐛 proxy promise deprecation
This commit is contained in:
1 parent
5cfd841c41
commit
af05799e12
2 files changed
+15
-9
No files matched your search
@@ -17,14 +17,20 @@ export default class ScopesScopeRolesRoleIndexRoute extends Route {
|
||||
*/
|
||||
async afterModel() {
|
||||
const currentScope = this.modelFor('scopes.scope');
|
||||
const subScopes = currentScope.isProject
|
||||
? []
|
||||
: (await this.store.query('scope', { scope_id: currentScope.id })).map(
|
||||
(scope) => ({
|
||||
model: scope,
|
||||
subScopes: this.store.query('scope', { scope_id: scope.id }),
|
||||
})
|
||||
);
|
||||
const scopes = await this.store.query('scope', {
|
||||
scope_id: currentScope.id,
|
||||
});
|
||||
let subScopes = [];
|
||||
//await the store query to fix ember's proxy promise deprecation warning
|
||||
if (!currentScope.isProject) {
|
||||
subScopes = await Promise.all(
|
||||
scopes.map(async (scope) => ({
|
||||
model: scope,
|
||||
subScopes: await this.store.query('scope', { scope_id: scope.id }),
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
||||
const grantScopes = [
|
||||
{
|
||||
model: currentScope,
|
||||
|
||||
Reference in new issue
Block a user