@droppii-org/chat-sdk
Version:
Droppii React Chat SDK
25 lines (24 loc) • 1.22 kB
JavaScript
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
import { useMutation } from "@tanstack/react-query";
import { QUERY_KEYS } from "../../services/query";
import { apiInstance } from "../../services/api";
import { ENDPOINTS } from "../../services/routes";
import useAuthStore from "../../store/auth";
export const useUpdateSessionInfo = () => useMutation({
mutationKey: [QUERY_KEYS.UPDATE_SESSION_INFO],
mutationFn: async (_a) => {
var { sessionId } = _a, data = __rest(_a, ["sessionId"]);
const res = await apiInstance.put(ENDPOINTS.chatService.updateSessionInfo(sessionId), Object.assign(Object.assign({}, data), { applicationType: useAuthStore.getState().applicationType }));
return res === null || res === void 0 ? void 0 : res.data;
},
});