@cripty2001/utils 0.0.89 → 0.0.91
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/dist/Appserver/client.js +18 -21
- package/dist/MailTemplate/index.js +0 -1
- package/package.json +1 -1
package/dist/Appserver/client.js
CHANGED
|
@@ -73,30 +73,27 @@ class Client {
|
|
|
73
73
|
},
|
|
74
74
|
body: new Blob([new Uint8Array((0, msgpack_1.encode)(input))], { type: 'application/msgpack' }),
|
|
75
75
|
});
|
|
76
|
+
if (res.status === 401 || res.status === 403) {
|
|
77
|
+
if (testedToken === this.authToken.value) {
|
|
78
|
+
this.setAuthToken(null);
|
|
79
|
+
}
|
|
80
|
+
throw new ClientError("Permission denied");
|
|
81
|
+
}
|
|
82
|
+
if (res.status === 404)
|
|
83
|
+
throw new ClientError("Not found");
|
|
76
84
|
const decoded = (0, msgpack_1.decode)(await res.arrayBuffer());
|
|
77
85
|
let responseData;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
case 200:
|
|
88
|
-
responseData = decoded;
|
|
89
|
-
return responseData;
|
|
90
|
-
case 422:
|
|
91
|
-
responseData = decoded;
|
|
92
|
-
throw new ClientValidationError(responseData.errors);
|
|
93
|
-
case 400:
|
|
94
|
-
case 500:
|
|
95
|
-
responseData = decoded;
|
|
96
|
-
throw new ClientServerError(responseData.code, responseData.error, responseData.payload);
|
|
97
|
-
default:
|
|
98
|
-
throw new ClientError(`Unexpected server response: ${res.status}`);
|
|
86
|
+
if (res.status === 200)
|
|
87
|
+
return decoded;
|
|
88
|
+
if (res.status === 422) {
|
|
89
|
+
responseData = decoded;
|
|
90
|
+
throw new ClientValidationError(responseData.errors);
|
|
91
|
+
}
|
|
92
|
+
if (res.status === 400 || res.status === 500) {
|
|
93
|
+
responseData = decoded;
|
|
94
|
+
throw new ClientServerError(responseData.code, responseData.error, responseData.payload);
|
|
99
95
|
}
|
|
96
|
+
throw new ClientError(`Unexpected server response: ${res.status}`);
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
exports.Client = Client;
|
package/package.json
CHANGED