diff --git a/src/js/repEs.js b/src/js/repEs.js index fe83f0177d00dc5b0f528cd7892c6411c71fcbde..2d1ba4fa20417ab043f7671607efb74d9a1d10fd 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' }