tering-serieuze-sdk 1.2.0 → 1.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tering-serieuze-sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Teringserieuze sdk",
5
5
  "author": "Frank",
6
6
  "main": "dist/index.mjs",
package/src/api/auth.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { BaseModule } from "./base";
2
2
 
3
3
  export class AuthModule extends BaseModule {
4
- protected static cacheKey = "TSS-TOKEN";
4
+ public static cacheKey = "TSS-TOKEN";
5
5
 
6
6
  async getToken(): Promise<string | undefined> {
7
7
  return this.cache.get(AuthModule.cacheKey);
@@ -6,8 +6,8 @@ export class CookieCache extends AbstractCache {
6
6
  }
7
7
 
8
8
  public async get<T>(key: string): Promise<T | undefined> {
9
- if (document.cookie.includes("auth=")) {
10
- return document.cookie.split("auth=")[1]?.split(";")[0] as T;
9
+ if (document.cookie.includes(`${key}=`)) {
10
+ return document.cookie.split(`${key}=`)[1]?.split(";")[0] as T;
11
11
  }
12
12
 
13
13
  return undefined;
@@ -15,11 +15,11 @@ export class CookieCache extends AbstractCache {
15
15
 
16
16
  public set<T>(key: string, value: T, lifetime?: number): void {
17
17
  const expires = lifetime ? new Date(Date.now() + lifetime).toUTCString() : "";
18
- document.cookie = `auth=${value}; expires=${expires}; path=/; samesite=strict; secure`;
18
+ document.cookie = `${key}=${value}; expires=${expires}; path=/; samesite=strict; secure`;
19
19
  }
20
20
 
21
21
  public remove(key: string): void {
22
- document.cookie = "auth=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
22
+ document.cookie = `${key}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
23
23
  }
24
24
 
25
25
  public clear(): void {