diff --git a/web/html/common/prompt_modal.html b/web/html/common/prompt_modal.html index 81c47306..528b8509 100644 --- a/web/html/common/prompt_modal.html +++ b/web/html/common/prompt_modal.html @@ -1,6 +1,7 @@ {{define "promptModal"}} { - inModal.loading(); - await this.addInbound(inbound, dbInbound); - inModal.close(); + await this.addInbound(inbound, dbInbound, inModal); }, isEdit: false }); @@ -875,9 +873,7 @@ inbound: inbound, dbInbound: dbInbound, confirm: async (inbound, dbInbound) => { - inModal.loading(); await this.updateInbound(inbound, dbInbound); - inModal.close(); }, isEdit: true }); @@ -960,9 +956,7 @@ okText: '{{ i18n "pages.client.submitAdd"}}', dbInbound: dbInbound, confirm: async (clients, dbInboundId) => { - clientModal.loading(); - await this.addClient(clients, dbInboundId); - clientModal.close(); + await this.addClient(clients, dbInboundId, clientModal); }, isEdit: false }); @@ -974,9 +968,7 @@ okText: '{{ i18n "pages.client.bulk"}}', dbInbound: dbInbound, confirm: async (clients, dbInboundId) => { - clientsBulkModal.loading(); - await this.addClient(clients, dbInboundId); - clientsBulkModal.close(); + await this.addClient(clients, dbInboundId, clientsBulkModal); }, }); }, @@ -1005,19 +997,19 @@ default: return clients.findIndex(item => item.id === client.id && item.email === client.email); } }, - async addClient(clients, dbInboundId) { + async addClient(clients, dbInboundId, modal) { const data = { id: dbInboundId, settings: '{"clients": [' + clients.toString() + ']}', }; - await this.submit(`/xui/inbound/addClient`, data); + await this.submit(`/xui/inbound/addClient`, data, modal); }, async updateClient(client, dbInboundId, clientId) { const data = { id: dbInboundId, settings: '{"clients": [' + client.toString() + ']}', }; - await this.submit(`/xui/inbound/updateClient/${clientId}`, data); + await this.submit(`/xui/inbound/updateClient/${clientId}`, data, clientModal); }, resetTraffic(dbInboundId) { dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); @@ -1120,8 +1112,8 @@ await this.updateClient(clients[index], dbInboundId, clientId); this.loading(false); }, - async submit(url, data) { - const msg = await HttpUtil.postWithModal(url, data); + async submit(url, data, modal) { + const msg = await HttpUtil.postWithModal(url, data, modal); if (msg.success) { await this.getDBInbounds(); } @@ -1280,7 +1272,6 @@ okText: '{{ i18n "pages.inbounds.import" }}', confirm: async (dbInboundText) => { await this.submit('/xui/inbound/import', {data: dbInboundText}, promptModal); - promptModal.close(); }, }); },