@uxf/cms 11.48.0 → 11.48.1

Sign up to get free protection for your applications and to get access to all the features.
package/api/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.dataGridAutocompleteGet = void 0;
4
5
  exports.contentGet = contentGet;
@@ -19,10 +20,9 @@ exports.userConfigGetAll = userConfigGetAll;
19
20
  exports.userConfigGet = userConfigGet;
20
21
  exports.uploadFile = uploadFile;
21
22
  const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
22
- const env_variables_1 = require("@uxf/example/src/config/env-variables");
23
23
  const api_1 = require("../lib/api");
24
24
  // TODO @vejvis - doufám, že tohle bude fungovat
25
- const { axiosRequest, axiosInstance } = (0, api_1.createAxiosInstance)(env_variables_1.envVariables.NEXT_PUBLIC_FRONTEND_URL);
25
+ const { axiosRequest, axiosInstance } = (0, api_1.createAxiosInstance)((_a = process.env.NEXT_PUBLIC_FRONTEND_URL) !== null && _a !== void 0 ? _a : "");
26
26
  function contentGet(ctx, contentId) {
27
27
  return axiosRequest(ctx, `/api/cms/content/${contentId}`, "get", null, null);
28
28
  }
@@ -1,7 +1,7 @@
1
1
  import { PropsWithChildren, ReactNode } from "react";
2
- import { FetcherResponse } from "swr/_internal";
2
+ import { SWRConfiguration } from "swr";
3
3
  interface Props {
4
- fetcher?: (arg: any) => FetcherResponse<any>;
4
+ swrConfig?: SWRConfiguration;
5
5
  }
6
6
  export declare function CmsProvider(props: PropsWithChildren<Props>): ReactNode;
7
7
  export {};
@@ -8,6 +8,11 @@ const react_1 = __importDefault(require("react"));
8
8
  const swr_1 = require("swr");
9
9
  const fetcher = (input) => fetch(input).then((res) => res.json());
10
10
  function CmsProvider(props) {
11
- var _a;
12
- return (react_1.default.createElement(swr_1.SWRConfig, { value: { provider: () => new Map(), fetcher: (_a = props.fetcher) !== null && _a !== void 0 ? _a : fetcher } }, props.children));
11
+ var _a, _b, _c, _d;
12
+ const swrConfig = {
13
+ ...props.swrConfig,
14
+ provider: (_b = (_a = props.swrConfig) === null || _a === void 0 ? void 0 : _a.provider) !== null && _b !== void 0 ? _b : (() => new Map()),
15
+ fetcher: (_d = (_c = props.swrConfig) === null || _c === void 0 ? void 0 : _c.fetcher) !== null && _d !== void 0 ? _d : fetcher,
16
+ };
17
+ return react_1.default.createElement(swr_1.SWRConfig, { value: swrConfig }, props.children);
13
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxf/cms",
3
- "version": "11.48.0",
3
+ "version": "11.48.1",
4
4
  "description": "UXF Cms",
5
5
  "author": "UXFans <dev@uxf.cz>",
6
6
  "homepage": "https://gitlab.com/uxf-npm/cms#readme",
@@ -6,6 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.useLoggedUser = useLoggedUser;
7
7
  const swr_1 = __importDefault(require("swr"));
8
8
  function useLoggedUser() {
9
- const { data, error, isLoading } = (0, swr_1.default)("/api/cms/user");
9
+ const { data, error, isLoading } = (0, swr_1.default)("/api/cms/user", {
10
+ keepPreviousData: true,
11
+ // immutable
12
+ revalidateIfStale: false,
13
+ revalidateOnFocus: false,
14
+ revalidateOnReconnect: false,
15
+ });
10
16
  return { data: data === null || data === void 0 ? void 0 : data.user, error, isLoading };
11
17
  }