flamerest 1.0.80 → 1.0.82

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.
Files changed (3) hide show
  1. package/REST.d.ts +2 -2
  2. package/REST.js +7 -1
  3. package/package.json +1 -1
package/REST.d.ts CHANGED
@@ -113,7 +113,7 @@ interface IREST {
113
113
  * @param username
114
114
  * @param password
115
115
  */
116
- auth(username?: string, password?: string): Promise<Authorized>,
116
+ auth(username?: string, password?: string, pushNotificationToken: object | null): Promise<Authorized>,
117
117
 
118
118
  /**
119
119
  * Зарегистрироваться с этим логином и паролем
@@ -122,7 +122,7 @@ interface IREST {
122
122
  * @param password
123
123
  * @param name
124
124
  */
125
- signup(email: string | null, username: string | null, password: string, name: string | null, pushNotificationToken: string | null): Promise<Authorized>,
125
+ signup(email: string | null, username: string | null, password: string, name: string | null, pushNotificationToken: object | null): Promise<Authorized>,
126
126
 
127
127
 
128
128
  /**
package/REST.js CHANGED
@@ -117,6 +117,12 @@ class FLAMEREST {
117
117
  Errs[err['field']] = Errs[err['field']] === undefined ? err['message'] : Errs[err['field']] + ". " + err['message']
118
118
  }
119
119
  ResolveBody.errors = Errs;
120
+ break;
121
+ case 401:
122
+ if (typeof this.unauthorized_callback === 'function') {
123
+ this.unauthorized_callback();
124
+ }
125
+ break;
120
126
  }
121
127
 
122
128
  }
@@ -491,7 +497,7 @@ class FLAMEREST {
491
497
  resp = await this.request(this.SERVER + '/auth/auth', JSON.stringify({}), 'POST', 'json', true);
492
498
  }
493
499
  else {
494
- resp = await this.request(this.SERVER + '/auth/auth', JSON.stringify({ login: username, password: password }), 'POST', 'json', false);
500
+ resp = await this.request(this.SERVER + '/auth/auth', JSON.stringify({ login: username, password: password, pushNotificationToken: (pushNotificationToken ?? this.pushNotificationToken ?? null) }), 'POST', 'json', false);
495
501
  }
496
502
 
497
503
  if (resp.errors) return resp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flamerest",
3
- "version": "1.0.80",
3
+ "version": "1.0.82",
4
4
  "description": "",
5
5
  "main": "REST.js",
6
6
  "typings": "./REST.d.ts",