storing changes, starting history list
This commit is contained in:
32
src/hooks/useSystemConfig.ts
Normal file
32
src/hooks/useSystemConfig.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
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,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user