diff options
| author | MohamedBassem <me@mbassem.com> | 2024-05-06 18:05:27 +0100 |
|---|---|---|
| committer | MohamedBassem <me@mbassem.com> | 2024-05-06 18:05:27 +0100 |
| commit | 32b5a025568dcc5788a8a2afc19bf07264e01a63 (patch) | |
| tree | 7ad808c667148154c9244cb3def56315da89ef52 /apps/mobile/app/dashboard | |
| parent | 02ef4bfc89e66fdf6593dd744aef53adee57b861 (diff) | |
| download | karakeep-32b5a025568dcc5788a8a2afc19bf07264e01a63.tar.zst | |
feature: Dedup links on creation. Fixes #49
Diffstat (limited to 'apps/mobile/app/dashboard')
| -rw-r--r-- | apps/mobile/app/dashboard/add-link.tsx | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/mobile/app/dashboard/add-link.tsx b/apps/mobile/app/dashboard/add-link.tsx index d913ac01..5096a9e7 100644 --- a/apps/mobile/app/dashboard/add-link.tsx +++ b/apps/mobile/app/dashboard/add-link.tsx @@ -3,17 +3,24 @@ import { Text, View } from "react-native"; import { useRouter } from "expo-router"; import { Button } from "@/components/ui/Button"; import { Input } from "@/components/ui/Input"; +import { useToast } from "@/components/ui/Toast"; import { api } from "@/lib/trpc"; export default function AddNote() { const [text, setText] = useState(""); const [error, setError] = useState<string | undefined>(); + const { toast } = useToast(); const router = useRouter(); const invalidateAllBookmarks = api.useUtils().bookmarks.getBookmarks.invalidate; const { mutate } = api.bookmarks.createBookmark.useMutation({ - onSuccess: () => { + onSuccess: (resp) => { + if (resp.alreadyExists) { + toast({ + message: "Bookmark already exists", + }); + } invalidateAllBookmarks(); if (router.canGoBack()) { router.replace("../"); |
