aboutsummaryrefslogtreecommitdiffstats
path: root/packages/shared-react/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'packages/shared-react/hooks')
-rw-r--r--packages/shared-react/hooks/tags.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/packages/shared-react/hooks/tags.ts b/packages/shared-react/hooks/tags.ts
index 6ce0f0c9..bbbe3d0e 100644
--- a/packages/shared-react/hooks/tags.ts
+++ b/packages/shared-react/hooks/tags.ts
@@ -1,5 +1,19 @@
import { api } from "../trpc";
+export function useCreateTag(
+ ...opts: Parameters<typeof api.tags.create.useMutation>
+) {
+ const apiUtils = api.useUtils();
+
+ return api.tags.create.useMutation({
+ ...opts[0],
+ onSuccess: (res, req, meta) => {
+ apiUtils.tags.list.invalidate();
+ return opts[0]?.onSuccess?.(res, req, meta);
+ },
+ });
+}
+
export function useUpdateTag(
...opts: Parameters<typeof api.tags.update.useMutation>
) {