'use strict';

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var reactQuery = require('@tanstack/react-query');
var constants$1 = require('@bigbinary/neeto-commons-frontend/constants');
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
var useCountriesApi = require('./useCountriesApi-CjhrbnjK.js');
var constants = require('./constants-D_H6M1Pm.js');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var useFetchProfile = function useFetchProfile(options) {
  return reactQuery.useQuery(_objectSpread({
    queryKey: [constants.QUERY_KEYS.USER_PROFILE],
    queryFn: useCountriesApi.profileApi.fetchUserDetails,
    staleTime: constants$1.DEFAULT_STALE_TIME
  }, options));
};
var useUpdateProfileMutation = function useUpdateProfileMutation(options) {
  return reactUtils.useMutationWithInvalidation(useCountriesApi.profileApi.updateUser, _objectSpread(_objectSpread({
    keysToInvalidate: [[constants.QUERY_KEYS.USER_PROFILE]]
  }, options), {}, {
    onSuccess: function onSuccess() {
      return window.location.reload();
    }
  }));
};

exports.useFetchProfile = useFetchProfile;
exports.useUpdateProfileMutation = useUpdateProfileMutation;
//# sourceMappingURL=useProfileApi-BcuLCyms.js.map
