add delete starterpack mutation

This commit is contained in:
Hailey
2024-06-06 21:15:05 -07:00
parent 000e4abb2f
commit ce651b1bb5
+24 -1
View File
@@ -1,8 +1,9 @@
import {AppBskyGraphGetStarterPack} from '@atproto/api'
import {useMutation} from '@tanstack/react-query'
import {useQuery} from 'react-query'
import {STALE} from 'state/queries/index'
import {useAgent} from 'state/session'
import {useAgent, useSession} from 'state/session'
const RQKEY_ROOT = 'starter-pack'
@@ -20,3 +21,25 @@ export function useStarterPackQuery({id}: {id: string}) {
staleTime: STALE.MINUTES.FIVE,
})
}
export function useDeleteStarterPackMutation({
onError,
onSuccess,
}: {
onError: () => void
onSuccess: () => void
}) {
const agent = useAgent()
const {currentAccount} = useSession()
return useMutation({
mutationFn: async (rkey: string) => {
await agent.app.bsky.graph.starterpack.delete({
repo: currentAccount!.did,
rkey,
})
},
onError,
onSuccess,
})
}