aboutsummaryrefslogtreecommitdiffstats
path: root/apps/mobile/app/dashboard
diff options
context:
space:
mode:
authorMohamedBassem <me@mbassem.com>2024-05-06 18:05:27 +0100
committerMohamedBassem <me@mbassem.com>2024-05-06 18:05:27 +0100
commit32b5a025568dcc5788a8a2afc19bf07264e01a63 (patch)
tree7ad808c667148154c9244cb3def56315da89ef52 /apps/mobile/app/dashboard
parent02ef4bfc89e66fdf6593dd744aef53adee57b861 (diff)
downloadkarakeep-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.tsx9
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("../");