@appello/services
Version:
Services package with api / graphql
14 lines (13 loc) • 1.64 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createQueryClient = void 0;
const react_query_1 = require("@tanstack/react-query");
const createQueryClient = ({ config }) => {
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
return new react_query_1.QueryClient({
defaultOptions: Object.assign({ queries: Object.assign({ retry: false }, ((_b = (_a = config === null || config === void 0 ? void 0 : config.defaultOptions) === null || _a === void 0 ? void 0 : _a.queries) !== null && _b !== void 0 ? _b : {})), mutations: Object.assign({ retry: false }, ((_d = (_c = config === null || config === void 0 ? void 0 : config.defaultOptions) === null || _c === void 0 ? void 0 : _c.mutations) !== null && _d !== void 0 ? _d : {})) }, ((_e = config === null || config === void 0 ? void 0 : config.defaultOptions) !== null && _e !== void 0 ? _e : {})),
queryCache: new react_query_1.QueryCache(Object.assign(Object.assign({}, config === null || config === void 0 ? void 0 : config.queryCache), { onError: (_g = (_f = config === null || config === void 0 ? void 0 : config.queryCache) === null || _f === void 0 ? void 0 : _f['onError']) !== null && _g !== void 0 ? _g : (() => { }) })),
mutationCache: new react_query_1.MutationCache(Object.assign(Object.assign({}, config === null || config === void 0 ? void 0 : config.mutationCache), { onError: (_j = (_h = config === null || config === void 0 ? void 0 : config.mutationCache) === null || _h === void 0 ? void 0 : _h['onError']) !== null && _j !== void 0 ? _j : (() => { }) })),
});
};
exports.createQueryClient = createQueryClient;