forked from verdnatura/hedera-web
refs #3971
This commit is contained in:
parent
6640314879
commit
11da415eb2
|
@ -15,9 +15,7 @@ require('tinymce/plugins/table');
|
|||
require('tinymce/plugins/autolink');
|
||||
require('tinymce/plugins/image');
|
||||
require('tinymce/plugins/charmap');
|
||||
require('tinymce/plugins/print');
|
||||
require('tinymce/plugins/preview');
|
||||
require('tinymce/plugins/hr');
|
||||
require('tinymce/plugins/anchor');
|
||||
require('tinymce/plugins/pagebreak');
|
||||
require('tinymce/plugins/searchreplace');
|
||||
|
@ -34,7 +32,6 @@ require('tinymce/plugins/table');
|
|||
require('tinymce/plugins/directionality');
|
||||
require('tinymce/plugins/emoticons');
|
||||
require('tinymce/plugins/template');
|
||||
require('tinymce/plugins/paste');
|
||||
const contentUiCss = require('tinymce/skins/ui/oxide/content.css');
|
||||
const contentCss = require('tinymce/skins/content/default/content.css');
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ module.exports = new Class({
|
|||
async send(url, params) {
|
||||
if (!params) params = {};
|
||||
params.srv = `json:${url}`;
|
||||
return await this.sendWithUrl('POST', '.', params);
|
||||
return this.sendWithUrl('POST', '.', params);
|
||||
},
|
||||
|
||||
async sendForm(form) {
|
||||
|
@ -136,11 +136,11 @@ module.exports = new Class({
|
|||
if (elements[i].name)
|
||||
params[elements[i].name] = elements[i].value;
|
||||
|
||||
return await this.sendWithUrl('POST', form.action, params);
|
||||
return this.sendWithUrl('POST', form.action, params);
|
||||
},
|
||||
|
||||
async sendFormMultipart(form) {
|
||||
return await this.request({
|
||||
return this.request({
|
||||
method: 'POST',
|
||||
url: form.action,
|
||||
data: new FormData(form)
|
||||
|
@ -148,7 +148,7 @@ module.exports = new Class({
|
|||
},
|
||||
|
||||
async sendFormData(formData) {
|
||||
return await this.request({
|
||||
return this.request({
|
||||
method: 'POST',
|
||||
url: '',
|
||||
data: formData
|
||||
|
@ -159,7 +159,7 @@ module.exports = new Class({
|
|||
* Called when REST response is received.
|
||||
*/
|
||||
async sendWithUrl(method, url, params) {
|
||||
return await this.request({
|
||||
return this.request({
|
||||
method,
|
||||
url,
|
||||
data: Vn.Url.makeUri(params),
|
||||
|
@ -174,15 +174,15 @@ module.exports = new Class({
|
|||
method: 'GET',
|
||||
url: `api/${url}`
|
||||
});
|
||||
return await this.request(config);
|
||||
return this.request(config);
|
||||
},
|
||||
|
||||
async post(url, data, config) {
|
||||
return await this.requestData('POST', url, data, config);
|
||||
return this.requestData('POST', url, data, config);
|
||||
},
|
||||
|
||||
async patch(url, data, config) {
|
||||
return await this.requestData('PATCH', url, data, config);
|
||||
return this.requestData('PATCH', url, data, config);
|
||||
},
|
||||
|
||||
async requestData(method, url, data, config) {
|
||||
|
@ -195,7 +195,7 @@ module.exports = new Class({
|
|||
config.headers = Object.assign({}, config.headers, {
|
||||
'Content-Type': 'application/json;charset=utf-8'
|
||||
});
|
||||
return await this.request(config);
|
||||
return this.request(config);
|
||||
},
|
||||
|
||||
async request(config) {
|
||||
|
@ -215,15 +215,13 @@ module.exports = new Class({
|
|||
});
|
||||
|
||||
request.send(config.data);
|
||||
this._addRequest();
|
||||
return await promise;
|
||||
},
|
||||
|
||||
_addRequest() {
|
||||
this._requestsCount++;
|
||||
|
||||
if (this._requestsCount === 1)
|
||||
this.emit('loading-changed', true);
|
||||
|
||||
return promise;
|
||||
},
|
||||
|
||||
_onStateChange(request, resolve, reject) {
|
||||
|
@ -308,12 +306,11 @@ module.exports = new Class({
|
|||
}
|
||||
|
||||
if (error) {
|
||||
reject(error);
|
||||
|
||||
if (error.exception == 'SessionExpired')
|
||||
this.clearToken();
|
||||
|
||||
this.emit('error', error);
|
||||
reject(error);
|
||||
} else
|
||||
resolve(data);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "hedera-web",
|
||||
"version": "22.48.20",
|
||||
"version": "22.48.0",
|
||||
"description": "Verdnatura web page",
|
||||
"license": "GPL-3.0",
|
||||
"repository": {
|
||||
|
|
Loading…
Reference in New Issue