kui-utils 0.0.25 → 0.0.27

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/index.d.ts CHANGED
@@ -151,7 +151,7 @@ declare const resHandler: <T>(result: [Error | null, T | undefined], loader: Loa
151
151
 
152
152
  declare const toNumber: (value?: string | number | null | undefined) => number | null;
153
153
 
154
- declare const updateQueryParams: (newLink: string) => void;
154
+ declare const updateQueryParams: (newLink: string, withBase?: boolean | undefined) => void;
155
155
 
156
156
  declare function addToIndexDBWithQueue(db: any, storeName: string, data: any, loader: Loader$1): void;
157
157
  declare const readFromIndexDB: (db: any, name: string, loader: Loader$1) => Promise<any>;
package/index.js CHANGED
@@ -1996,13 +1996,14 @@ var toNumber = function (value) {
1996
1996
  : null;
1997
1997
  };
1998
1998
 
1999
- var updateQueryParams = function (newLink) {
1999
+ var updateQueryParams = function (newLink, withBase) {
2000
2000
  var searchQuery = new URLSearchParams(window.location.search);
2001
2001
  var hrefLinkParams = newLink.split(/\?|&/);
2002
2002
  var hrefParams = Object.fromEntries(new URLSearchParams(hrefLinkParams.slice(1).join("&")).entries());
2003
2003
  var searchParams = Object.fromEntries(searchQuery.entries());
2004
+ var route =
2004
2005
  // @ts-ignore
2005
- var route = searchQuery.size ? hrefLinkParams[0] : window.location.pathname;
2006
+ searchQuery.size && !withBase ? hrefLinkParams[0] : window.location.pathname;
2006
2007
  Object.keys(searchParams).forEach(function (key, index) {
2007
2008
  if (key in hrefParams) {
2008
2009
  searchParams[key] = hrefParams[key];
@@ -2205,7 +2206,12 @@ var Loader = /** @class */ (function () {
2205
2206
  };
2206
2207
  this.setError = function (errorMessage, err) {
2207
2208
  _this.hasError = true;
2208
- _this.errorMessage = "".concat(errorMessage || "request").concat(err ? ": \n".concat(formatError(err)) : "");
2209
+ if (err.status === 403) {
2210
+ _this.errorMessage = "You do not have access to this";
2211
+ }
2212
+ else {
2213
+ _this.errorMessage = "".concat(errorMessage || "request").concat(err ? ": \n".concat(formatError(err)) : "");
2214
+ }
2209
2215
  };
2210
2216
  this.cleanError = function () {
2211
2217
  _this.hasError = false;