Jobber/orchestrator/src/client/hooks/queries/useSettingsMutation.ts
Shaheer Sarfaraz 3640abef2d
Migration to tanstack query (#199)
* commit at some point in the middle, WIP

* formatting

* ci passing

* comments

* handle no jobid case

* better error handling

* comments

* Update orchestrator/src/client/hooks/queries/useJobMutations.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update orchestrator/src/client/hooks/queries/useSettingsMutation.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* better types

* formatter

* tracking inbox page

* in progress page

* tracer links page

* invalidate harder

* ensure tracer links docs show

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-02-19 23:04:47 +00:00

15 lines
510 B
TypeScript

import * as api from "@client/api";
import type { UpdateSettingsInput } from "@shared/settings-schema";
import { useMutation, useQueryClient } from "@tanstack/react-query";
import { invalidateSettingsData } from "./invalidate";
export function useUpdateSettingsMutation() {
const queryClient = useQueryClient();
return useMutation({
mutationFn: (payload: UpdateSettingsInput) => api.updateSettings(payload),
onSuccess: async () => {
await invalidateSettingsData(queryClient);
},
});
}