import { useMutation, useQuery } from "@tanstack/react-query"; import { sendBlobFileUpload } from "../components/SettingForms/System/Upload"; import { toast } from "sonner"; import { handleSystemSave, handleSystemRecall, } from "../components/SettingForms/System/SettingSaveRecall"; export const useSystemConfig = () => { const uploadSettingsMutation = useMutation({ mutationKey: ["uploadSettings"], mutationFn: sendBlobFileUpload, onError: () => console.log("upload failed"), onSuccess: (test) => console.log(test), }); const saveSystemSettings = useMutation({ mutationKey: ["systemSaveSettings"], mutationFn: handleSystemSave, onSuccess: () => toast("System Settings Saved Successfully!"), }); const getSystemSettings = useQuery({ queryKey: ["getSystemSettings"], queryFn: handleSystemRecall, }); return { uploadSettings: uploadSettingsMutation.mutate, saveSystemSettings: saveSystemSettings.mutate, getSystemSettingsData: getSystemSettings.data, }; };