aboutsummaryrefslogtreecommitdiffstats
path: root/apps/web/components/dashboard
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-08-25 00:48:37 +0300
committerMohamedBassem <me@mbassem.com>2024-08-25 00:52:15 +0300
commitd8cf7c17a2b0a437cf4a2f983f5ab48fba775a64 (patch)
tree7732dbb08a5272b11a5e4c8c638b25110c65c33a /apps/web/components/dashboard
parent6fba4aac850c831365e61954c49f653401da33bb (diff)
downloadkarakeep-d8cf7c17a2b0a437cf4a2f983f5ab48fba775a64.tar.zst
feature(mobile): Allow editing notes from the mobile app
Diffstat (limited to 'apps/web/components/dashboard')
-rw-r--r--apps/web/components/dashboard/bookmarks/BookmarkedTextEditor.tsx31
1 files changed, 12 insertions, 19 deletions
diff --git a/apps/web/components/dashboard/bookmarks/BookmarkedTextEditor.tsx b/apps/web/components/dashboard/bookmarks/BookmarkedTextEditor.tsx
index 74e94f94..e0434943 100644
--- a/apps/web/components/dashboard/bookmarks/BookmarkedTextEditor.tsx
+++ b/apps/web/components/dashboard/bookmarks/BookmarkedTextEditor.tsx
@@ -12,8 +12,8 @@ import {
} from "@/components/ui/dialog";
import { Textarea } from "@/components/ui/textarea";
import { toast } from "@/components/ui/use-toast";
-import { api } from "@/lib/trpc";
+import { useUpdateBookmarkText } from "@hoarder/shared-react/hooks/bookmarks";
import { BookmarkTypes, ZBookmark } from "@hoarder/shared/types/bookmarks";
export function BookmarkedTextEditor({
@@ -32,24 +32,17 @@ export function BookmarkedTextEditor({
: "",
);
- const invalidateOneBookmarksCache =
- api.useUtils().bookmarks.getBookmark.invalidate;
-
- const { mutate: updateBookmarkMutator, isPending } =
- api.bookmarks.updateBookmarkText.useMutation({
- onSuccess: () => {
- invalidateOneBookmarksCache({
- bookmarkId: bookmark.id,
- });
- toast({
- description: "Note updated!",
- });
- setOpen(false);
- },
- onError: () => {
- toast({ description: "Something went wrong", variant: "destructive" });
- },
- });
+ const { mutate: updateBookmarkMutator, isPending } = useUpdateBookmarkText({
+ onSuccess: () => {
+ toast({
+ description: "Note updated!",
+ });
+ setOpen(false);
+ },
+ onError: () => {
+ toast({ description: "Something went wrong", variant: "destructive" });
+ },
+ });
const onSave = () => {
updateBookmarkMutator({