propro-common-components 0.1.5 → 0.1.7

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,6 +1,7 @@
1
1
  import React from "react";
2
2
  type StateType = {
3
3
  loading: boolean;
4
+ requestsEnabled: boolean;
4
5
  };
5
6
  interface Props {
6
7
  children: React.ReactNode;
@@ -50560,20 +50560,32 @@ async function sendEmail(m, g) {
50560
50560
  g("failedSubmit");
50561
50561
  }
50562
50562
  }
50563
- const initialState = { loading: !1 }, AppContext = createContext({
50563
+ const initialState = {
50564
+ loading: !1,
50565
+ requestsEnabled: getCookie("account") !== void 0
50566
+ }, AppContext = createContext({
50564
50567
  state: initialState,
50565
50568
  dispatch: () => null
50566
50569
  }), AppProvider = ({ children: m, baseURL: g }) => {
50567
50570
  axios.defaults.baseURL = g, axios.defaults.withCredentials = !0;
50568
- const b = (C, $) => {
50569
- switch ($.type) {
50571
+ const b = ($, I) => {
50572
+ switch (I.type) {
50570
50573
  case "SET_LOADING":
50571
- return { ...C, loading: $.payload };
50574
+ return { ...$, loading: I.payload };
50575
+ case "SET_REQUEST_ENABLED":
50576
+ return { ...$, requestsEnabled: I.payload };
50572
50577
  default:
50573
- return C;
50578
+ return $;
50579
+ }
50580
+ }, [_, x] = useReducer(b, initialState), C = async () => {
50581
+ try {
50582
+ await axios.post("/refreshToken"), x({ type: "SET_REQUEST_ENABLED", payload: !0 });
50583
+ } catch ($) {
50584
+ console.log($);
50574
50585
  }
50575
- }, [_, x] = useReducer(b, initialState);
50576
- return /* @__PURE__ */ jsx$2(AppContext.Provider, { value: { state: _, dispatch: x }, children: m });
50586
+ };
50587
+ return useEffect(() => (_.requestsEnabled || C(), () => {
50588
+ }), []), /* @__PURE__ */ jsx$2(AppContext.Provider, { value: { state: _, dispatch: x }, children: m });
50577
50589
  }, queryClient = new QueryClient(), AppHOC = ({ children: m }) => /* @__PURE__ */ jsxs(QueryClientProvider, { client: queryClient, children: [
50578
50590
  /* @__PURE__ */ jsx$2(ReactQueryDevtools, { initialIsOpen: !1 }),
50579
50591
  /* @__PURE__ */ jsx$2(AppProvider, { baseURL: "", children: m })
@@ -56975,8 +56987,8 @@ var _sharedExports = _shared.exports, id$1 = 0, px = Math.random(), _uid = funct
56975
56987
  for (; g.length > _; )
56976
56988
  has$5(b, C = g[_++]) && (~arrayIndexOf(x, C) || x.push(C));
56977
56989
  return x;
56978
- }, _enumBugKeys = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","), $keys$1 = _objectKeysInternal, enumBugKeys$1 = _enumBugKeys, _objectKeys = Object.keys || function(g) {
56979
- return $keys$1(g, enumBugKeys$1);
56990
+ }, _enumBugKeys = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","), $keys$2 = _objectKeysInternal, enumBugKeys$1 = _enumBugKeys, _objectKeys = Object.keys || function(g) {
56991
+ return $keys$2(g, enumBugKeys$1);
56980
56992
  }, _objectGops = {};
56981
56993
  _objectGops.f = Object.getOwnPropertySymbols;
56982
56994
  var _objectPie = {}, hasRequired_objectPie;
@@ -57228,17 +57240,11 @@ var iterator$1 = _wksExt.f("iterator"), iterator = { default: iterator$1, __esMo
57228
57240
  return g;
57229
57241
  }, cof = _cof, _isArray = Array.isArray || function(g) {
57230
57242
  return cof(g) == "Array";
57231
- }, _objectGopnExt = {}, _objectGopn = {}, hasRequired_objectGopn;
57232
- function require_objectGopn() {
57233
- if (hasRequired_objectGopn)
57234
- return _objectGopn;
57235
- hasRequired_objectGopn = 1;
57236
- var m = _objectKeysInternal, g = _enumBugKeys.concat("length", "prototype");
57237
- return _objectGopn.f = Object.getOwnPropertyNames || function(_) {
57238
- return m(_, g);
57239
- }, _objectGopn;
57240
- }
57241
- var toIObject$2 = _toIobject, gOPN$1 = require_objectGopn().f, toString = {}.toString, windowNames = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [], getWindowNames = function(m) {
57243
+ }, _objectGopnExt = {}, _objectGopn = {}, $keys$1 = _objectKeysInternal, hiddenKeys = _enumBugKeys.concat("length", "prototype");
57244
+ _objectGopn.f = Object.getOwnPropertyNames || function(g) {
57245
+ return $keys$1(g, hiddenKeys);
57246
+ };
57247
+ var toIObject$2 = _toIobject, gOPN$1 = _objectGopn.f, toString = {}.toString, windowNames = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [], getWindowNames = function(m) {
57242
57248
  try {
57243
57249
  return gOPN$1(m);
57244
57250
  } catch {
@@ -57309,7 +57315,7 @@ USE_NATIVE || ($Symbol = function() {
57309
57315
  return DESCRIPTORS && setter && setSymbolDesc(ObjectProto, g, { configurable: !0, set: b }), wrap(g);
57310
57316
  }, redefine($Symbol[PROTOTYPE], "toString", function() {
57311
57317
  return this._k;
57312
- }), $GOPD.f = $getOwnPropertyDescriptor, $DP.f = $defineProperty, require_objectGopn().f = gOPNExt.f = $getOwnPropertyNames, require_objectPie().f = $propertyIsEnumerable, $GOPS.f = $getOwnPropertySymbols, DESCRIPTORS && !_library && redefine(ObjectProto, "propertyIsEnumerable", $propertyIsEnumerable), wksExt.f = function(m) {
57318
+ }), $GOPD.f = $getOwnPropertyDescriptor, $DP.f = $defineProperty, _objectGopn.f = gOPNExt.f = $getOwnPropertyNames, require_objectPie().f = $propertyIsEnumerable, $GOPS.f = $getOwnPropertySymbols, DESCRIPTORS && !_library && redefine(ObjectProto, "propertyIsEnumerable", $propertyIsEnumerable), wksExt.f = function(m) {
57313
57319
  return wrap(wks(m));
57314
57320
  });
57315
57321
  $export$2($export$2.G + $export$2.W + $export$2.F * !USE_NATIVE, { Symbol: $Symbol });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-common-components",
3
- "version": "0.1.05",
3
+ "version": "0.1.07",
4
4
  "type": "module",
5
5
  "main": "dist/propro-common-components.js",
6
6
  "types": "dist/main.d.ts",