Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Rahimi <alirahimi818@gmail.com>2024-01-21 17:26:19 +0300
committerGitHub <noreply@github.com>2024-01-21 17:26:19 +0300
commit5c695ca6520c9cd9c44b18119a862f8f480969af (patch)
tree56e739defaf1f1d0326cb30235b1cb6dcf2699e2 /web/assets
parente7ce8c8ddb8472695b296eac305c5ac9b8c1d3d8 (diff)
add group user with the same subscription id to all inbounds (#1650)
Diffstat (limited to 'web/assets')
-rw-r--r--web/assets/js/util/utils.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/web/assets/js/util/utils.js b/web/assets/js/util/utils.js
index 61b322bd..48ff237d 100644
--- a/web/assets/js/util/utils.js
+++ b/web/assets/js/util/utils.js
@@ -83,6 +83,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 {