@djust-b2b/djust-front-sdk 1.21.17 → 1.21.18
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.
|
@@ -122,10 +122,11 @@ const hybridRoutePatterns = [
|
|
|
122
122
|
"/v2/shop/autocomplete",
|
|
123
123
|
"/v2/shop/search",
|
|
124
124
|
];
|
|
125
|
-
const
|
|
125
|
+
const routeIsPublic = (path, method) => {
|
|
126
126
|
var _a;
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
if (publicRoutes.has(path) && ((_a = publicRoutes.get(path)) === null || _a === void 0 ? void 0 : _a.has(method)))
|
|
128
|
+
return true;
|
|
129
|
+
return publicRoutePatterns.some((pattern) => path.startsWith(pattern));
|
|
129
130
|
};
|
|
130
131
|
const isHybridRoute = (path) => {
|
|
131
132
|
return hybridRoutePatterns.some((pattern) => path.startsWith(pattern));
|
|
@@ -145,7 +146,7 @@ const enhancedFetch = async ({ path, method, params = {}, body, }) => {
|
|
|
145
146
|
"dj-api-key": apiKey,
|
|
146
147
|
"Content-Type": "application/json",
|
|
147
148
|
});
|
|
148
|
-
if (
|
|
149
|
+
if (!routeIsPublic(path, method) && !isHybridRoute) {
|
|
149
150
|
if (!accessToken) {
|
|
150
151
|
const error = new Error("[Djust SDK] Private route need accessToken.");
|
|
151
152
|
Sentry.captureException(error, {
|