zavadil-ts-common 1.2.46 → 1.2.48

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.
@@ -24,12 +24,12 @@ export class IdTokenProviderDefault implements OAuthIdTokenProvider {
24
24
  .getIdToken()
25
25
  .catch(
26
26
  (err) => {
27
- console.log("No token in url, loading from storage", err);
27
+ console.log("No token in url, loading from storage:", err);
28
28
  return this.storage
29
29
  .getIdToken()
30
30
  .catch(
31
31
  (err) => {
32
- console.log("No token in storage, redirecting to login page", err);
32
+ console.log("No token in storage, redirecting to login page:", err);
33
33
  return this.login.getIdToken();
34
34
  }
35
35
  );
@@ -37,8 +37,9 @@ export class IdTokenProviderDefault implements OAuthIdTokenProvider {
37
37
  )
38
38
  .then(
39
39
  (t) => {
40
- console.log("Token in URL, saving to storage and redirecting");
40
+ console.log("Token found, saving to storage...");
41
41
  this.storage.saveIdTokenToLocalStorage(t);
42
+ // redirect if token is in url
42
43
  return this.url.reset();
43
44
  }
44
45
  );
@@ -32,6 +32,7 @@ export class IdTokenProviderUrl extends RedirectionProvider implements OAuthIdTo
32
32
  reset(): Promise<any> {
33
33
  const raw = this.getIdTokenFromUrl();
34
34
  if (raw === null || StringUtil.isBlank(raw)) return Promise.resolve();
35
+ console.log("Token in URL, redirecting...");
35
36
  const thisUrl = UrlUtil.deleteParamFromUrl(document.location.toString(), this.tokenQueryName);
36
37
  return this.redirectTo(thisUrl);
37
38
  }
@@ -5,7 +5,7 @@ export default class UrlUtil {
5
5
  static deleteParamFromUrl(url: string, paramName: string): string {
6
6
  const urlObj = new URL(url);
7
7
  urlObj.searchParams.delete(paramName);
8
- return StringUtil.trimTrailingSlashes(url.toString());
8
+ return StringUtil.trimTrailingSlashes(urlObj.toString());
9
9
  }
10
10
 
11
11
  static extractParamFromUrl(url: string, name: string): string | null {