aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared-react/hooks/users.ts
blob: e896f8e41f4f28f6b14a751a70de92e729674992 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { api } from "../trpc";

export function useUpdateUserSettings(
  ...opts: Parameters<typeof api.users.updateSettings.useMutation>
) {
  const apiUtils = api.useUtils();
  return api.users.updateSettings.useMutation({
    ...opts[0],
    onSuccess: (res, req, meta) => {
      apiUtils.users.settings.invalidate();
      return opts[0]?.onSuccess?.(res, req, meta);
    },
  });
}