@bigbinary/neeto-commons-frontend 2.1.5 → 2.1.6

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.
@@ -173,6 +173,13 @@ var showErrorToastr = function showErrorToastr(error) {
173
173
  }
174
174
  return error;
175
175
  };
176
+ var getUrlPathName = function getUrlPathName(url) {
177
+ try {
178
+ return new URL(url).pathname;
179
+ } catch (_unused) {
180
+ return url;
181
+ }
182
+ };
176
183
  var handle404ErrorResponse = function handle404ErrorResponse(error) {
177
184
  var _error$config4, _error$response4;
178
185
  var _ref4 = (_error$config4 = error.config) !== null && _error$config4 !== void 0 ? _error$config4 : {},
@@ -182,11 +189,13 @@ var handle404ErrorResponse = function handle404ErrorResponse(error) {
182
189
  show403ErrorPage = _ref4$show403ErrorPag === void 0 ? true : _ref4$show403ErrorPag;
183
190
  var status = (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.status;
184
191
  if (status === 404 && show404ErrorPage || status === 403 && show403ErrorPage) {
192
+ var _error$request;
193
+ var fullUrl = ((_error$request = error.request) === null || _error$request === void 0 ? void 0 : _error$request.responseURL) || error.config.url;
185
194
  reactUtils.useErrorDisplayStore.setState({
186
195
  showErrorPage: true,
187
196
  statusCode: status,
188
- failedApiUrl: error.config.url,
189
- failedApiPath: new URL(error.config.url).pathname
197
+ failedApiUrl: fullUrl,
198
+ failedApiPath: getUrlPathName(fullUrl)
190
199
  });
191
200
  }
192
201
  return error;