curtain-web-api 1.0.25 → 1.0.27

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.
@@ -155,8 +155,8 @@ class CurtainWebAPI {
155
155
  this.user.curtainLinkLimit = response.data.curtain_link_limit;
156
156
  this.user.totalCurtain = response.data.total_curtain;
157
157
  this.user.curtainLinkLimitExceeded = response.data.curtain_link_limit_exceeded;
158
- console.log(this.user);
159
158
  return this.user.updateDB().then((response) => {
159
+ console.log(this.user);
160
160
  return this.user;
161
161
  });
162
162
  });
@@ -188,8 +188,7 @@ class CurtainWebAPI {
188
188
  this.user.access_token = response.data.access;
189
189
  this.user.refresh_token = response.data.refresh;
190
190
  this.user.loginStatus = true;
191
- console.log(this.user);
192
- }).then((response) => {
191
+ this.user.saveIntoDB().then();
193
192
  return this.getUserInfo();
194
193
  });
195
194
  }
@@ -24,7 +24,7 @@ export declare class User {
24
24
  init(): Promise<void | undefined>;
25
25
  initiateDB(): Promise<void>;
26
26
  updateDB(): Promise<void>;
27
- saveIntoDB(): Promise<void>;
27
+ saveIntoDB(): Promise<void | undefined>;
28
28
  loadFromDB(): Promise<void>;
29
29
  clearDB(): Promise<void>;
30
30
  reset(): void;
@@ -105,6 +105,10 @@ class User {
105
105
  console.log(response);
106
106
  }).catch((error) => {
107
107
  console.log(error);
108
+ console.log(this.loginStatus);
109
+ if (error.name === "conflict") {
110
+ return this.updateDB();
111
+ }
108
112
  });
109
113
  }
110
114
  loadFromDB() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curtain-web-api",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -135,9 +135,8 @@ export class CurtainWebAPI {
135
135
  this.user.curtainLinkLimit = response.data.curtain_link_limit;
136
136
  this.user.totalCurtain = response.data.total_curtain;
137
137
  this.user.curtainLinkLimitExceeded = response.data.curtain_link_limit_exceeded;
138
- console.log(this.user)
139
138
  return this.user.updateDB().then((response) => {
140
-
139
+ console.log(this.user)
141
140
  return this.user;
142
141
  });
143
142
 
@@ -173,10 +172,9 @@ export class CurtainWebAPI {
173
172
  this.user.access_token = response.data.access;
174
173
  this.user.refresh_token = response.data.refresh;
175
174
  this.user.loginStatus = true;
176
- console.log(this.user)
177
- }).then((response) => {
175
+ this.user.saveIntoDB().then();
178
176
  return this.getUserInfo();
179
- });
177
+ })
180
178
  }
181
179
 
182
180
  checkIfRefreshTokenExpired() {
@@ -113,6 +113,10 @@ export class User {
113
113
  console.log(response);
114
114
  }).catch((error) => {
115
115
  console.log(error);
116
+ console.log(this.loginStatus);
117
+ if (error.name === "conflict") {
118
+ return this.updateDB();
119
+ }
116
120
  });
117
121
  }
118
122