From fe13408831dce4bdae4911098d6079a097cae9e8 Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Tue, 9 Apr 2024 15:49:24 +0100
Subject: feature(web): Allow uploading directly into lists/tags. Fixes #69

---
 apps/web/components/dashboard/bookmarks/EditorCard.tsx | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

(limited to 'apps/web/components/dashboard/bookmarks/EditorCard.tsx')

diff --git a/apps/web/components/dashboard/bookmarks/EditorCard.tsx b/apps/web/components/dashboard/bookmarks/EditorCard.tsx
index b9e46a30..10ad1f13 100644
--- a/apps/web/components/dashboard/bookmarks/EditorCard.tsx
+++ b/apps/web/components/dashboard/bookmarks/EditorCard.tsx
@@ -7,12 +7,13 @@ import { Separator } from "@/components/ui/separator";
 import { Textarea } from "@/components/ui/textarea";
 import { toast } from "@/components/ui/use-toast";
 import { useClientConfig } from "@/lib/clientConfig";
-import { api } from "@/lib/trpc";
 import { cn } from "@/lib/utils";
 import { zodResolver } from "@hookform/resolvers/zod";
 import { useForm } from "react-hook-form";
 import { z } from "zod";
 
+import { useCreateBookmarkWithPostHook } from "@hoarder/shared-react/hooks/bookmarks";
+
 function useFocusOnKeyPress(inputRef: React.RefObject<HTMLTextAreaElement>) {
   useEffect(() => {
     function handleKeyPress(e: KeyboardEvent) {
@@ -47,10 +48,8 @@ export default function EditorCard({ className }: { className?: string }) {
   useImperativeHandle(ref, () => inputRef.current);
   useFocusOnKeyPress(inputRef);
 
-  const invalidateBookmarksCache = api.useUtils().bookmarks.invalidate;
-  const { mutate, isPending } = api.bookmarks.createBookmark.useMutation({
+  const { mutate, isPending } = useCreateBookmarkWithPostHook({
     onSuccess: () => {
-      invalidateBookmarksCache();
       form.reset();
     },
     onError: () => {
-- 
cgit v1.2.3-70-g09d2

