Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
at main 28 lines 740 B view raw
1import {type AppBskyActorDefs} from '@atproto/api' 2import {useMutation, useQueryClient} from '@tanstack/react-query' 3 4import {preferencesQueryKey} from '#/state/queries/preferences' 5import {useAgent} from '#/state/session' 6 7export function usePostInteractionSettingsMutation({ 8 onError, 9 onSettled, 10}: { 11 onError?: (error: Error) => void 12 onSettled?: () => void 13} = {}) { 14 const qc = useQueryClient() 15 const agent = useAgent() 16 return useMutation({ 17 async mutationFn(props: AppBskyActorDefs.PostInteractionSettingsPref) { 18 await agent.setPostInteractionSettings(props) 19 }, 20 async onSuccess() { 21 await qc.invalidateQueries({ 22 queryKey: preferencesQueryKey, 23 }) 24 }, 25 onError, 26 onSettled, 27 }) 28}