Skip to content

Commit

Permalink
feat: toast after feed added or updated
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed May 31, 2024
1 parent 2608d37 commit ff80f1b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/renderer/src/pages/add/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { useMutation } from "@tanstack/react-query"
import { useEffect } from "react"
import { useForm } from "react-hook-form"
import { z } from "zod"
import { useToast } from "@renderer/components/ui/use-toast"

const formSchema = z.object({
view: z.string(),
Expand Down Expand Up @@ -65,6 +66,7 @@ export function Component() {
}
}, [feed.data?.subscription])

const { toast } = useToast()
const followMutation = useMutation({
mutationFn: async (values: z.infer<typeof formSchema>) =>
apiFetch("/subscriptions", {
Expand Down Expand Up @@ -95,6 +97,10 @@ export function Component() {
client?.invalidateQuery(
Queries.feed.byId({ id: feed.data?.feed.id }).key,
)
toast({
duration: 1000,
description: isSubscribed ? "🎉 Updated." : "🎉 Followed.",
})
},
})

Expand Down

0 comments on commit ff80f1b

Please sign in to comment.