how to pass a query string in useCustomMutation
How does one pass a query string in useCustomMutation?
Seems like the ?foo=bar gehts stripped from the url?
Things i tried so far:
still no query string in the network tab
Seems like the ?foo=bar gehts stripped from the url?
Things i tried so far:
const {
mutate,
mutation: { isPending },
} = useCustomMutation<CalcResult, HttpError, { legacy: boolean }>({
mutationOptions: {
retry: false,
mutationKey: ["wizard", "calculate_abrechnung", qs.periode, qs.unit, useLegacy],
onError: (error) => {
console.error("Calculate Abrechnung error:", error)
toast.error(error?.message ?? "Fehler bei der Berechnung")
},
onSuccess: (data) => {
console.log("Calculate Abrechnung success:", data)
setCalcResult(data.data as CalcResult)
toast.success("Berechnung erfolgreich")
},
},
})
const runMutate = () => {
const url = useLegacy ? `${apiUrl}/api/custom/calculate_abrechnung?legacy=true` : `${apiUrl}/api/custom/calculate_abrechnung`
console.log("🚀 ~ 04_compute.tsx:136 ~ runMutate ~ url:", url)
mutate({
url: url,
method: "post",
values: { periode_id: qs.periode, einheit_id: qs.unit },
config: {
query: {
legacy: useLegacy ? "true" : "false", // Query-Parameter für den Legacy-Modus
}
},
meta: {
variables: {
foo: "bar",
},
legacy: "true",
},
})
} const {
mutate,
mutation: { isPending },
} = useCustomMutation<CalcResult, HttpError, { legacy: boolean }>({
mutationOptions: {
retry: false,
mutationKey: ["wizard", "calculate_abrechnung", qs.periode, qs.unit, useLegacy],
onError: (error) => {
console.error("Calculate Abrechnung error:", error)
toast.error(error?.message ?? "Fehler bei der Berechnung")
},
onSuccess: (data) => {
console.log("Calculate Abrechnung success:", data)
setCalcResult(data.data as CalcResult)
toast.success("Berechnung erfolgreich")
},
},
})
const runMutate = () => {
const url = useLegacy ? `${apiUrl}/api/custom/calculate_abrechnung?legacy=true` : `${apiUrl}/api/custom/calculate_abrechnung`
console.log("🚀 ~ 04_compute.tsx:136 ~ runMutate ~ url:", url)
mutate({
url: url,
method: "post",
values: { periode_id: qs.periode, einheit_id: qs.unit },
config: {
query: {
legacy: useLegacy ? "true" : "false", // Query-Parameter für den Legacy-Modus
}
},
meta: {
variables: {
foo: "bar",
},
legacy: "true",
},
})
}still no query string in the network tab
