propro-common-components 0.1.13 → 0.1.14

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.
@@ -50568,24 +50568,24 @@ const initialState = {
50568
50568
  dispatch: () => null
50569
50569
  }), AppProvider = ({ children: m, baseURL: g }) => {
50570
50570
  axios.defaults.baseURL = g, axios.defaults.withCredentials = !0;
50571
- const b = ($, I) => {
50572
- switch (I.type) {
50571
+ const b = useRef(!0), _ = (I, R) => {
50572
+ switch (R.type) {
50573
50573
  case "SET_LOADING":
50574
- return { ...$, loading: I.payload };
50574
+ return { ...I, loading: R.payload };
50575
50575
  case "SET_REQUEST_ENABLED":
50576
- return { ...$, requestsEnabled: I.payload };
50576
+ return { ...I, requestsEnabled: R.payload };
50577
50577
  default:
50578
- return $;
50578
+ return I;
50579
50579
  }
50580
- }, [_, x] = useReducer(b, initialState), C = async () => {
50580
+ }, [x, C] = useReducer(_, initialState), $ = async () => {
50581
50581
  try {
50582
- x({ type: "SET_LOADING", payload: !0 }), await axios.post("/api/refreshToken"), x({ type: "SET_REQUEST_ENABLED", payload: !0 }), x({ type: "SET_LOADING", payload: !1 });
50583
- } catch ($) {
50584
- console.log($), x({ type: "SET_LOADING", payload: !1 });
50582
+ C({ type: "SET_LOADING", payload: !0 }), await axios.post("/api/refreshToken"), C({ type: "SET_REQUEST_ENABLED", payload: !0 }), C({ type: "SET_LOADING", payload: !1 });
50583
+ } catch (I) {
50584
+ console.log(I), C({ type: "SET_LOADING", payload: !1 });
50585
50585
  }
50586
50586
  };
50587
- return useEffect(() => (_.requestsEnabled || C(), () => {
50588
- }), []), /* @__PURE__ */ jsx$2(AppContext.Provider, { value: { state: _, dispatch: x }, children: m });
50587
+ return useEffect(() => (b.current && !x.requestsEnabled && ($(), b.current = !1), () => {
50588
+ }), []), /* @__PURE__ */ jsx$2(AppContext.Provider, { value: { state: x, dispatch: C }, children: m });
50589
50589
  }, queryClient = new QueryClient(), AppHOC = ({ children: m }) => /* @__PURE__ */ jsxs(QueryClientProvider, { client: queryClient, children: [
50590
50590
  /* @__PURE__ */ jsx$2(ReactQueryDevtools, { initialIsOpen: !1 }),
50591
50591
  /* @__PURE__ */ jsx$2(AppProvider, { baseURL: "", children: m })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-common-components",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "type": "module",
5
5
  "main": "dist/propro-common-components.js",
6
6
  "types": "dist/main.d.ts",