@ludo.ninja/components 2.2.1 → 2.2.2

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,2 +1 @@
1
- import { AppProps } from "next/app";
2
- export declare function useApollo(pageProps: AppProps['pageProps']): import("@apollo/client").ApolloClient<import("@apollo/client").NormalizedCacheObject>;
1
+ export declare function useApollo(pageProps?: any): import("@apollo/client").ApolloClient<import("@apollo/client").NormalizedCacheObject>;
@@ -5,8 +5,20 @@ const react_1 = require("react");
5
5
  const graphql_1 = require("../../api/graphql");
6
6
  const api_1 = require("@ludo.ninja/api");
7
7
  const env_1 = require("../../store/env");
8
+ const nookies_1 = require("nookies");
9
+ const ludoDomains_1 = require("@ludo.ninja/core/build/ludoDomains");
8
10
  function useApollo(pageProps) {
9
- const NEXT_PUBLIC_ENV_DOMAIN = (0, env_1.useEnvStore)((state) => state.NEXT_PUBLIC_ENV_DOMAIN);
10
- const state = pageProps[graphql_1.APOLLO_STATE_PROP_NAME];
11
- return (0, react_1.useMemo)(() => api_1.graphqlConfig.initializeApollo(state, NEXT_PUBLIC_ENV_DOMAIN), [state]);
11
+ const { NEXT_PUBLIC_ENV_VALUE, NEXT_PUBLIC_ENV_DOMAIN } = (0, env_1.useEnvStore)((state) => ({
12
+ NEXT_PUBLIC_ENV_VALUE: state.NEXT_PUBLIC_ENV_VALUE,
13
+ NEXT_PUBLIC_ENV_DOMAIN: state.NEXT_PUBLIC_ENV_DOMAIN,
14
+ }));
15
+ const state = pageProps?.[graphql_1.APOLLO_STATE_PROP_NAME] || null;
16
+ return (0, react_1.useMemo)(() => api_1.graphqlConfig.createErrorAuthInterceptor(api_1.graphqlConfig.initializeApollo(state, NEXT_PUBLIC_ENV_DOMAIN), () => {
17
+ api_1.authCookies.destroyCookies(NEXT_PUBLIC_ENV_DOMAIN);
18
+ (0, nookies_1.destroyCookie)(null, "authMultiversXWallet", {
19
+ path: "/",
20
+ domain: NEXT_PUBLIC_ENV_DOMAIN,
21
+ });
22
+ window.location.replace(`${ludoDomains_1.ludoDomains[NEXT_PUBLIC_ENV_VALUE]["welcome"]}?alertError=authServerError`);
23
+ }), [state]);
12
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ludo.ninja/components",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
4
4
  "private": false,
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",