mirror of
https://github.com/FranP-code/create-better-t-stack.git
synced 2025-10-12 23:52:15 +00:00
update orpc tanstack query integration (#299)
This commit is contained in:
@@ -65,12 +65,12 @@ export default function TodosPage() {
|
||||
);
|
||||
const toggleMutation = useMutation(
|
||||
orpc.todo.toggle.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
const deleteMutation = useMutation(
|
||||
orpc.todo.delete.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
{{/if}}
|
||||
@@ -86,12 +86,12 @@ export default function TodosPage() {
|
||||
);
|
||||
const toggleMutation = useMutation(
|
||||
trpc.todo.toggle.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
const deleteMutation = useMutation(
|
||||
trpc.todo.delete.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
{{/if}}
|
||||
|
||||
@@ -62,12 +62,12 @@ export default function Todos() {
|
||||
);
|
||||
const toggleMutation = useMutation(
|
||||
orpc.todo.toggle.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
})
|
||||
);
|
||||
const deleteMutation = useMutation(
|
||||
orpc.todo.delete.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
})
|
||||
);
|
||||
{{/if}}
|
||||
@@ -83,12 +83,12 @@ export default function Todos() {
|
||||
);
|
||||
const toggleMutation = useMutation(
|
||||
trpc.todo.toggle.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
})
|
||||
);
|
||||
const deleteMutation = useMutation(
|
||||
trpc.todo.delete.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
})
|
||||
);
|
||||
{{/if}}
|
||||
|
||||
@@ -67,12 +67,12 @@ function TodosRoute() {
|
||||
);
|
||||
const toggleMutation = useMutation(
|
||||
orpc.todo.toggle.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
const deleteMutation = useMutation(
|
||||
orpc.todo.delete.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
{{/if}}
|
||||
@@ -88,12 +88,12 @@ function TodosRoute() {
|
||||
);
|
||||
const toggleMutation = useMutation(
|
||||
trpc.todo.toggle.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
const deleteMutation = useMutation(
|
||||
trpc.todo.delete.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
{{/if}}
|
||||
|
||||
@@ -17,7 +17,7 @@ import { useSuspenseQuery } from "@tanstack/react-query";
|
||||
import { convexQuery } from "@convex-dev/react-query";
|
||||
import { useMutation } from "convex/react";
|
||||
import { api } from "@{{projectName}}/backend/convex/_generated/api";
|
||||
import type { Id } from "@{{projectName}}/backend/convex/_generated/dataModel.js";
|
||||
import type { Id } from "@{{projectName}}/backend/convex/_generated/dataModel";
|
||||
{{else}}
|
||||
{{#if (eq api "trpc")}}
|
||||
import { useTRPC } from "@/utils/trpc";
|
||||
@@ -92,12 +92,12 @@ function TodosRoute() {
|
||||
);
|
||||
const toggleMutation = useMutation(
|
||||
trpc.todo.toggle.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
const deleteMutation = useMutation(
|
||||
trpc.todo.delete.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
{{/if}}
|
||||
@@ -113,12 +113,12 @@ function TodosRoute() {
|
||||
);
|
||||
const toggleMutation = useMutation(
|
||||
orpc.todo.toggle.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
const deleteMutation = useMutation(
|
||||
orpc.todo.delete.mutationOptions({
|
||||
onSuccess: () => todos.refetch(),
|
||||
onSuccess: () => { todos.refetch() },
|
||||
}),
|
||||
);
|
||||
{{/if}}
|
||||
|
||||
Reference in New Issue
Block a user