wet-aquaW
Refine3y ago
30 replies
wet-aqua

Docs outdated?

Docs says I can create custom Http req this way:
import { useUpdate } from "@refinedev/core";

const { mutate } = useUpdate();

mutate({
  resource: "posts",
  id: 1,
  variables: {
    title: "New title",
  },
  meta: {
    method: "put",
  },
});


and when I do the same, I get this TS error:
Argument of type '{ resource: string; id: number; meta: { method: string; }; }' is not assignable to parameter of type 'UpdateParams<BaseRecord, HttpError, {}>'.
  Property 'values' is missing in type '{ resource: string; id: number; meta: { method: string; }; }' but required in type '{ resource: string; id: BaseKey; mutationMode?: MutationMode | undefined; undoableTimeout?: number | undefined; onCancel?: ((cancelMutation: () => void) => void) | undefined; ... 5 more ...; optimisticUpdateMap?: OptimisticUpdateMapType<...> | undefined; }'.ts(2345)
useUpdate.d.ts(28, 5): 'values' is declared here.

//CODE
const { mutate: getOtp } = useUpdate();
 getOtp({
      resource: "posts",
      id: 1,
      meta: {
        method: "put",
      },
    });


I'm using latest version of refine, I just upgraded it.
Was this page helpful?