fix: 🐛 redirect to index on save without read

This commit is contained in:
dharini committed 2021-09-08 11:29:13 -07:00
1 parent e613d55dcb
commit 92572395bb
4 files changed
+23 -7

No files matched your search

@@ -60,10 +60,14 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
)
async save(authMethod) {
await authMethod.save();
await this.transitionTo(
'scopes.scope.auth-methods.auth-method',
authMethod
);
if (this.can.can('read model', authMethod)) {
await this.transitionTo(
'scopes.scope.auth-methods.auth-method',
authMethod
);
} else {
await this.transitionTo('scopes.scope.auth-method');
}
this.refresh();
}
+5 -1
View File
@@ -58,7 +58,11 @@ export default class ScopesScopeRolesRoute extends Route {
)
async save(role) {
await role.save();
await this.transitionTo('scopes.scope.roles.role', role);
if (this.can.can('read model', role)) {
await this.transitionTo('scopes.scope.roles.role', role);
} else {
await this.transitionTo('scopes.scope.roles');
}
this.refresh();
}
+5 -1
View File
@@ -60,7 +60,11 @@ export default class ScopesScopeTargetsRoute extends Route {
)
async save(target) {
await target.save();
await this.transitionTo('scopes.scope.targets.target', target);
if (this.can.can('read model', target)) {
await this.transitionTo('scopes.scope.targets.target', target);
} else {
await this.transitionTo('scopes.scope.targets');
}
this.refresh();
}
+5 -1
View File
@@ -59,7 +59,11 @@ export default class ScopesScopeUsersRoute extends Route {
)
async save(user) {
await user.save();
await this.transitionTo('scopes.scope.users.user', user);
if (this.can.can('read model', user)) {
await this.transitionTo('scopes.scope.users.user', user);
} else {
await this.transitionTo('scopes.scope.users');
}
this.refresh();
}