about summary refs log tree commit diff
path: root/src/state/queries/post-interaction-settings.ts
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2025-02-06 11:51:40 -0600
committerGitHub <noreply@github.com>2025-02-06 11:51:40 -0600
commit9cd4f92027774029234e38980fac3a12f136166f (patch)
tree52805dd7ba11a128bc0cf582c984d89d9a7c390d /src/state/queries/post-interaction-settings.ts
parent1db2668a96208046ffe316114f65d432e57db994 (diff)
downloadvoidsky-9cd4f92027774029234e38980fac3a12f136166f.tar.zst
[APP-1013] Configure and apply default post interaction settings from user preferences (#7664)
* Add interaction settings screen

* Move header out of interaction settings form

* WIP hook it up

* Thread through default settings into composer

* Update copy pasta

* Handle edited state

* Copy feedback

* Sentence case

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>

* Update copy

* Bump SDK

* Fix new type error

* Less in your face

* Remove new dep

* Add slot

* Copy edit

---------

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>
Diffstat (limited to 'src/state/queries/post-interaction-settings.ts')
-rw-r--r--src/state/queries/post-interaction-settings.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/state/queries/post-interaction-settings.ts b/src/state/queries/post-interaction-settings.ts
new file mode 100644
index 000000000..a256f2956
--- /dev/null
+++ b/src/state/queries/post-interaction-settings.ts
@@ -0,0 +1,20 @@
+import {AppBskyActorDefs} from '@atproto/api'
+import {useMutation, useQueryClient} from '@tanstack/react-query'
+
+import {preferencesQueryKey} from '#/state/queries/preferences'
+import {useAgent} from '#/state/session'
+
+export function usePostInteractionSettingsMutation() {
+  const qc = useQueryClient()
+  const agent = useAgent()
+  return useMutation({
+    async mutationFn(props: AppBskyActorDefs.PostInteractionSettingsPref) {
+      await agent.setPostInteractionSettings(props)
+    },
+    async onSuccess() {
+      await qc.invalidateQueries({
+        queryKey: preferencesQueryKey,
+      })
+    },
+  })
+}