feat: add success message after updating mute list

This commit is contained in:
codytseng
2025-06-04 22:30:01 +08:00
parent ec1692c066
commit b59391f277

View File

@@ -7,6 +7,7 @@ import { Event } from 'nostr-tools'
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react' import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react'
import { z } from 'zod' import { z } from 'zod'
import { useNostr } from './NostrProvider' import { useNostr } from './NostrProvider'
import { useToast } from '@/hooks'
type TMuteListContext = { type TMuteListContext = {
mutePubkeys: string[] mutePubkeys: string[]
@@ -31,6 +32,7 @@ export const useMuteList = () => {
} }
export function MuteListProvider({ children }: { children: React.ReactNode }) { export function MuteListProvider({ children }: { children: React.ReactNode }) {
const { toast } = useToast()
const { const {
pubkey: accountPubkey, pubkey: accountPubkey,
muteListEvent, muteListEvent,
@@ -108,7 +110,12 @@ export function MuteListProvider({ children }: { children: React.ReactNode }) {
await new Promise((resolve) => setTimeout(resolve, 1000)) await new Promise((resolve) => setTimeout(resolve, 1000))
} }
const newMuteListDraftEvent = createMuteListDraftEvent(tags, content) const newMuteListDraftEvent = createMuteListDraftEvent(tags, content)
return await publish(newMuteListDraftEvent) const event = await publish(newMuteListDraftEvent)
toast({
title: 'Mute list updated',
description: 'Your mute list has been updated successfully.'
})
return event
} }
const mutePubkeyPublicly = async (pubkey: string) => { const mutePubkeyPublicly = async (pubkey: string) => {