@cripty2001/utils 0.0.73 → 0.0.74

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.
@@ -64,11 +64,12 @@ class Client {
64
64
  return this.unsafeExec(`/exec/${action}`, input);
65
65
  }
66
66
  async unsafeExec(action, input) {
67
+ const testedToken = this.authToken.value;
67
68
  const res = await fetch(`${this.url}${action}`, {
68
69
  method: "POST",
69
70
  headers: {
70
71
  "Content-Type": "application/vnd.msgpack",
71
- ...(this.authToken.value !== null ? { "Authorization": `Bearer ${this.authToken.value}` } : {}),
72
+ ...(testedToken !== null ? { "Authorization": `Bearer ${testedToken}` } : {}),
72
73
  },
73
74
  body: new Blob([new Uint8Array((0, msgpack_1.encode)(input))], { type: 'application/msgpack' }),
74
75
  });
@@ -77,7 +78,11 @@ class Client {
77
78
  switch (res.status) {
78
79
  case 401:
79
80
  case 403:
80
- this.setAuthToken(null);
81
+ if (testedToken === this.authToken.value) {
82
+ console.log("Invalidating token");
83
+ this.setAuthToken(null);
84
+ console.log("Token invalidated");
85
+ }
81
86
  throw new ClientError("Permission denied");
82
87
  case 200:
83
88
  responseData = decoded;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "description": "Internal Set of utils. If you need them use them, otherwise go to the next package ;)",
5
5
  "homepage": "https://github.com/cripty2001/utils#readme",
6
6
  "bugs": {