diff options
| author | Ali Rahimi <alirahimi818@gmail.com> | 2025-01-21 05:01:54 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-21 05:01:54 +0300 |
| commit | 6e9180a6659479ea0b872d3c1bc4727fdd8571bd (patch) | |
| tree | a69ae46d922ae6982e3067debcd23d899e7fa09c /web/assets/js/util/utils.js | |
| parent | 66fe84181b9c4e2f6c6be943a7f486b4308c32ff (diff) | |
Group Management of Subscription Clients (#2644)
* add group user with the same subscription id to all inbounds
* code format compare
* add await for reset client traffic
* en language changed
* added client traffic syncer job
* handle exist email duplicate in sub group
* multi reset and delete request for clients group
* add client traffic syncer setting option
* vi translate file updated
* auto open qr-modal bug fixed
Diffstat (limited to 'web/assets/js/util/utils.js')
| -rw-r--r-- | web/assets/js/util/utils.js | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/web/assets/js/util/utils.js b/web/assets/js/util/utils.js index 30f1f6a2..28ec95c7 100644 --- a/web/assets/js/util/utils.js +++ b/web/assets/js/util/utils.js @@ -70,6 +70,41 @@ class HttpUtil { } return msg; } + + static async jsonPost(url, data) { + let msg; + try { + const requestOptions = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(data), + }; + const resp = await fetch(url, requestOptions); + const response = await resp.json(); + + msg = this._respToMsg({data : response}); + } catch (e) { + msg = new Msg(false, e.toString()); + } + this._handleMsg(msg); + return msg; + } + + static async postWithModalJson(url, data, modal) { + if (modal) { + modal.loading(true); + } + const msg = await this.jsonPost(url, data); + if (modal) { + modal.loading(false); + if (msg instanceof Msg && msg.success) { + modal.close(); + } + } + return msg; + } } class PromiseUtil { |
