fix: 🐛 Fix error when deleting auth method (#2273)

✅ Closes: https://hashicorp.atlassian.net/browse/ICU-13624
This commit is contained in:
Zhihe Li authored and GitHub committed 2024-04-25 11:48:55 -04:00
1 parent c64e8a2993
commit dccf06cb0c
1 file changed
+2 -2
@@ -142,11 +142,11 @@ export default class ScopesScopeAuthMethodsIndexController extends Controller {
@notifyError(({ message }) => message, { catch: true })
@notifySuccess('notifications.delete-success')
async delete(authMethod) {
const scopeID = authMethod.scopeID;
await authMethod.destroyRecord();
// Reload the scope, since this is where the primary_auth_method_id is
// stored. An auth method deletion could affect this field.
const scope = this.store.peekRecord('scope', authMethod.scopeID);
await scope.reload();
await this.store.findRecord('scope', scopeID, { reload: true });
this.router.replaceWith('scopes.scope.auth-methods');
await this.router.refresh();
}