24 lines
642 B
TypeScript
24 lines
642 B
TypeScript
import { useMutation, useQuery } from "@tanstack/react-query";
|
|
import * as api from "../service/SettingService";
|
|
import { ChangePasswordType, UpdateSettingType } from "../types/SettingTypes";
|
|
|
|
export const useGetSettings = () => {
|
|
return useQuery({
|
|
queryKey: ["settings"],
|
|
queryFn: () => api.getSettings(),
|
|
});
|
|
};
|
|
|
|
export const useUpdateSetting = () => {
|
|
return useMutation({
|
|
mutationFn: (variables: UpdateSettingType) => api.updateSettings(variables),
|
|
});
|
|
};
|
|
|
|
export const useChangePassword = () => {
|
|
return useMutation({
|
|
mutationFn: (variables: ChangePasswordType) =>
|
|
api.changePassword(variables),
|
|
});
|
|
};
|