core&ui: move domain_delete to domain_dashboard page

This commit is contained in:
undefined committed 2023-03-02 15:15:36 +08:00
1 parent ebc3d83ea0
commit 09240c6166
3 files changed
+24 -22

No files matched your search

+8 -8
View File
@@ -99,14 +99,6 @@ class DomainEditHandler extends ManageHandler {
await domain.edit(args.domainId, $set);
this.response.redirect = this.url('domain_dashboard');
}
@requireSudo
async postDelete({ domainId }) {
if (domainId === 'system') throw new CannotDeleteSystemDomainError();
if (this.domain.owner !== this.user._id) throw new OnlyOwnerCanDeleteDomainError();
await domain.del(domainId);
this.response.redirect = this.url('home_domain', { domainId: 'system' });
}
}
class DomainDashboardHandler extends ManageHandler {
@@ -129,6 +121,14 @@ class DomainDashboardHandler extends ManageHandler {
}
this.back();
}
@requireSudo
async postDelete({ domainId }) {
if (domainId === 'system') throw new CannotDeleteSystemDomainError();
if (this.domain.owner !== this.user._id) throw new OnlyOwnerCanDeleteDomainError();
await domain.del(domainId);
this.response.redirect = this.url('home_domain', { domainId: 'system' });
}
}
class DomainUserHandler extends ManageHandler {