@rixl/sdk 0.8.1 → 0.8.2
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/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2808,9 +2808,11 @@ function configureSdkClient() {
|
|
|
2808
2808
|
});
|
|
2809
2809
|
client.interceptors.request.use(async (request) => {
|
|
2810
2810
|
if (request.headers.has("Authorization")) return request;
|
|
2811
|
-
|
|
2811
|
+
const { pathname } = new URL(request.url);
|
|
2812
|
+
if (isPublicRoute(request.method, pathname)) return request;
|
|
2812
2813
|
const token = await tokenResolver();
|
|
2813
|
-
if (token)
|
|
2814
|
+
if (!token) throw new ApiError("No access token available for an authenticated request", HTTP_STATUS.UNAUTHORIZED, pathname);
|
|
2815
|
+
request.headers.set("Authorization", `Bearer ${token}`);
|
|
2814
2816
|
return request;
|
|
2815
2817
|
});
|
|
2816
2818
|
client.interceptors.error.use((error, response, request) => {
|