e7d349bc30
Task 8: codemod repointed 150 namespace-type files to #/lexicons (AppBskyFeedDefs.PostView -> app.bsky.feed.defs.PostView, .Record -> .Main) plus ~105 hand-fixed consumers (composer/video state, DebugMod, Profile, onboarding, dialogs). DM_SERVICE_HEADERS deleted; last chat call sites on the chat client. RichText.tsx flipped to SDK-only. Remaining @atproto/api importers: the three session bridge files, the deliberate dual-world matcher in lib/xrpc-error.ts, and test fixtures. toLex boundary casts are TODO(phase4)-tagged for bridge removal. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
30 lines
801 B
TypeScript
30 lines
801 B
TypeScript
import {setPostInteractionSettings} from '@bsky.app/sdk'
|
|
import {useMutation, useQueryClient} from '@tanstack/react-query'
|
|
|
|
import {preferencesQueryKey} from '#/state/queries/preferences'
|
|
import {usePdsClient} from '#/state/session'
|
|
import {type app} from '#/lexicons'
|
|
|
|
export function usePostInteractionSettingsMutation({
|
|
onError,
|
|
onSettled,
|
|
}: {
|
|
onError?: (error: Error) => void
|
|
onSettled?: () => void
|
|
} = {}) {
|
|
const qc = useQueryClient()
|
|
const client = usePdsClient()
|
|
return useMutation({
|
|
async mutationFn(props: app.bsky.actor.defs.PostInteractionSettingsPref) {
|
|
await client.call(setPostInteractionSettings, props)
|
|
},
|
|
async onSuccess() {
|
|
await qc.invalidateQueries({
|
|
queryKey: preferencesQueryKey,
|
|
})
|
|
},
|
|
onError,
|
|
onSettled,
|
|
})
|
|
}
|