30 lines
792 B
JavaScript
30 lines
792 B
JavaScript
import { useMutation } from "@tanstack/react-query"
|
|
import ExpenseRepository from "../repositories/ExpsenseRepository"
|
|
import showToast from "../services/toastService"
|
|
|
|
|
|
|
|
// -------------------Query------------------------------------------------------
|
|
export const useExpenseList = ()=>{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ---------------------------Mutation---------------------------------------------
|
|
|
|
export const useCreateExpnse =()=>{
|
|
return useMutation({
|
|
mutationFn:(payload)=>{
|
|
await ExpenseRepository.CreateExpense(payload)
|
|
},
|
|
onSuccess:(_,variables)=>{
|
|
showToast("Expense Created Successfully","success")
|
|
},
|
|
onError:(error)=>{
|
|
showToast(error.message || "Something went wrong please try again !","success")
|
|
}
|
|
})
|
|
} |