@ludo.ninja/components 2.2.61 → 2.3.0

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.
@@ -1 +1 @@
1
- export declare const useSignOut: () => () => Promise<void>;
1
+ export declare const useSignOut: () => (includeRedirect?: boolean) => Promise<void>;
@@ -17,7 +17,7 @@ const useSignOut = () => {
17
17
  }));
18
18
  const { revokeToken } = (0, useRevokeToken_1.default)();
19
19
  const setUser = (0, store_1.useUserStore)((state) => state.setUser);
20
- return async () => {
20
+ return async (includeRedirect = true) => {
21
21
  try {
22
22
  await revokeToken();
23
23
  }
@@ -33,7 +33,7 @@ const useSignOut = () => {
33
33
  setUser(null);
34
34
  // when invite code is not required = no redirect
35
35
  // window.location.replace(ludoDomains[NEXT_PUBLIC_ENV_VALUE as TEnvValue]["welcome"]);
36
- if (window.location.origin === ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["account"]) {
36
+ if (includeRedirect && window.location.origin === ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["account"]) {
37
37
  window.location.replace(ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["welcome"]);
38
38
  }
39
39
  }
@@ -26,11 +26,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.useVerification = void 0;
27
27
  const useSignIn_1 = require("./useSignIn");
28
28
  const useSignOut_1 = require("./useSignOut");
29
- const env_1 = require("../../../store/env");
30
29
  const useVerification = () => {
31
30
  const signIn = (0, useSignIn_1.useSignIn)();
32
31
  const signOut = (0, useSignOut_1.useSignOut)();
33
- const isProd = (0, env_1.useEnvStore)((state) => state.isProd);
32
+ // const isProd = useEnvStore((state) => state.isProd);
34
33
  return async (currentLocation) => {
35
34
  try {
36
35
  const authCookies = await Promise.resolve().then(() => __importStar(require("@ludo.ninja/api/build/cookies"))); //update check version cookie in client
@@ -54,8 +53,9 @@ const useVerification = () => {
54
53
  }
55
54
  else {
56
55
  // when invite code is not required = no redirect in sign out
57
- if (isProd() && currentLocation !== "/forms/[formId]" && currentLocation !== "/minting") {
58
- await signOut();
56
+ // if (isProd() && currentLocation !== "/forms/[formId]" && currentLocation !== "/minting") {
57
+ if (currentLocation !== "/forms/[formId]" && currentLocation !== "/minting") {
58
+ await signOut(false);
59
59
  }
60
60
  }
61
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.2.61",
3
+ "version": "2.3.0",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",