laravel-request 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "laravel-request",
3
3
  "productName": "laravel-request",
4
- "version": "1.1.2",
4
+ "version": "1.1.4",
5
5
  "description": "laravel-request",
6
6
  "main": "src/index.js",
7
7
  "scripts": {},
@@ -12,6 +12,7 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "dependencies": {
15
- "axios": "^1.3.2"
15
+ "axios": "^1.3.2",
16
+ "query-string": "^8.1.0"
16
17
  }
17
18
  }
package/src/ApiRequest.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import Builder from "./Builder";
2
2
  import Binding from "./Binding";
3
3
  import Api from "./Api";
4
- import NotifyManager from "../../interface/notify/NotifyManager";
5
4
 
6
5
  /**
7
6
  *
@@ -19,6 +18,12 @@ export default class ApiRequest {
19
18
  */
20
19
  xhr = null;
21
20
 
21
+ /**
22
+ *
23
+ * @type {null}
24
+ */
25
+ static notifyClass = null;
26
+
22
27
  /**
23
28
  *
24
29
  * @param target
@@ -56,6 +61,11 @@ export default class ApiRequest {
56
61
  });
57
62
  }
58
63
 
64
+ getNotifyManager()
65
+ {
66
+ return ApiRequest.notifyClass;
67
+ }
68
+
59
69
  setUrl(url)
60
70
  {
61
71
  this.url = url;
@@ -186,7 +196,7 @@ export default class ApiRequest {
186
196
 
187
197
  if(result)
188
198
  {
189
- notify = NotifyManager.info('Успешно', response.meta.text)
199
+ notify = this.getNotifyManager().info('Успешно', response.meta.text)
190
200
  }
191
201
  }
192
202
  self.toBind(response);
@@ -212,7 +222,7 @@ export default class ApiRequest {
212
222
  {
213
223
  switch (xhr.status) {
214
224
  case 0://точно ошибка
215
- notify = NotifyManager.error('Ошибка', errorText);
225
+ notify = this.getNotifyManager().error('Ошибка', errorText);
216
226
  break;
217
227
  case 404:
218
228
 
@@ -220,16 +230,16 @@ export default class ApiRequest {
220
230
  default:
221
231
  if(xhr?.responseJSON?.meta.text)
222
232
  {
223
- notify = NotifyManager.error('Ошибка', xhr.responseJSON.meta.text);
233
+ notify = this.getNotifyManager().error('Ошибка', xhr.responseJSON.meta.text);
224
234
  }else if(xhr?.responseJSON?.meta.message)
225
235
  {
226
- notify = NotifyManager.error('Ошибка', xhr.responseJSON.meta.message);
236
+ notify = this.getNotifyManager().error('Ошибка', xhr.responseJSON.meta.message);
227
237
  }else{
228
238
  if(typeof errorText === 'string')
229
239
  {
230
- notify = NotifyManager.error('Ошибка', errorText);
240
+ notify = this.getNotifyManager().error('Ошибка', errorText);
231
241
  }else if(errorText?.message && typeof errorText.message === 'string'){
232
- notify = NotifyManager.error('Ошибка', errorText.message);
242
+ notify = this.getNotifyManager().error('Ошибка', errorText.message);
233
243
  }
234
244
  }
235
245
  break;
@@ -237,18 +247,18 @@ export default class ApiRequest {
237
247
  }
238
248
  } catch (e) {
239
249
  console.error(e);
240
- notify = this.notify ? NotifyManager.error('Ошибка') : null;
250
+ notify = this.notify ? this.getNotifyManager().error('Ошибка') : null;
241
251
  }
242
252
  }
243
253
  else if (xhr.readyState === 0) {
244
- notify = NotifyManager.errorOnce('network_error', 'Ошибка', ' (Network Error) или невозможность получения доступа к сети');
254
+ notify = this.getNotifyManager().errorOnce('network_error', 'Ошибка', ' (Network Error) или невозможность получения доступа к сети');
245
255
  }
246
256
  else {
247
257
  if(typeof errorText === 'string')
248
258
  {
249
- notify = NotifyManager.error('Ошибка', errorText);
259
+ notify = this.getNotifyManager().error('Ошибка', errorText);
250
260
  }else if(errorText?.message && typeof errorText.message === 'string'){
251
- notify = NotifyManager.error('Ошибка', errorText.message);
261
+ notify = this.getNotifyManager().error('Ошибка', errorText.message);
252
262
  }
253
263
  }
254
264
 
@@ -300,7 +310,7 @@ export default class ApiRequest {
300
310
  {
301
311
  if (response.meta && response.meta.text)
302
312
  {
303
- notify = this.notify ? NotifyManager.info('Успешно', response.meta.text) : null
313
+ notify = this.notify ? this.getNotifyManager().info('Успешно', response.meta.text) : null
304
314
  }
305
315
  self.toBind(response);
306
316
  self.resetBindErrors();
@@ -1,6 +1,5 @@
1
1
  import Api from "./Api";
2
2
  import ApiRequest from "./ApiRequest";
3
- import NotifyManager from "../../interface/notify/NotifyManager";
4
3
 
5
4
  /**
6
5
  *
@@ -31,7 +30,7 @@ export default class NewApiRequest extends ApiRequest
31
30
  {
32
31
  if (response.meta && response.meta.text)
33
32
  {
34
- notify = this.notify ? NotifyManager.info('Успешно', response.meta.text) : null
33
+ notify = this.notify ? this.getNotifyManager().info('Успешно', response.meta.text) : null
35
34
  }
36
35
  self.toBind(response);
37
36
  self.resetBindErrors();
package/src/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import Api from "src/Api";
2
- import ApiProxy from "src/ApiProxy";
3
- import ApiRequest from "src/ApiRequest";
4
- import Binding from "src/Binding";
5
- import Builder from "src/Builder";
6
- import NewApi from "src/NewApi";
7
- import NewApiRequest from "src/NewApiRequest";
8
- import UrlBind from "src/UrlBind";
1
+ import Api from "./Api";
2
+ import ApiProxy from "./ApiProxy";
3
+ import ApiRequest from "./ApiRequest";
4
+ import Binding from "./Binding";
5
+ import Builder from "./Builder";
6
+ import NewApi from "./NewApi";
7
+ import NewApiRequest from "./NewApiRequest";
8
+ import UrlBind from "./UrlBind";
9
9
 
10
10
 
11
11