feat: toast after feed added or updated

This commit is contained in:
DIYgod 2024-06-01 01:09:10 +08:00
parent 2608d37d87
commit ff80f1b1c2
No known key found for this signature in database
1 changed files with 6 additions and 0 deletions

View File

@ -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(),
@ -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", {
@ -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.",
})
},
})