From c2223113687fc4554848efd8b4aa05ef311bc6db Mon Sep 17 00:00:00 2001 From: weixin_44463441 Date: Thu, 11 Jan 2024 16:50:00 +0800 Subject: [PATCH] Thu Jan 11 16:50:00 CST 2024 inscode --- src/js/repEs.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/js/repEs.js b/src/js/repEs.js index fe83f01..2d1ba4f 100644 --- a/src/js/repEs.js +++ b/src/js/repEs.js @@ -42,16 +42,24 @@ class RepEs { } add (content) { + const name = '/' + this.index_name const url = this.index_url + '/' + this.index_name const token = this.token + + const instance = axios.create({ + baseURL: this.index_url, + timeout: 5000, + withCredentials: true, // 允许跨域请求 + }); + + return new Promise(function(resolve,rejcet){ - axios.put(url, + instance.put(name, { user_token: token, content: content, }, { - withCredentials: true, headers: { 'Content-Type': 'application/json' } -- GitLab