about summary refs log tree commit diff
path: root/src/state/queries
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/queries')
-rw-r--r--src/state/queries/messages/actor-declaration.ts22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/state/queries/messages/actor-declaration.ts b/src/state/queries/messages/actor-declaration.ts
index c8cc4acbd..0886af382 100644
--- a/src/state/queries/messages/actor-declaration.ts
+++ b/src/state/queries/messages/actor-declaration.ts
@@ -21,9 +21,9 @@ export function useUpdateActorDeclaration({
       if (!currentAccount) throw new Error('Not logged in')
       // TODO(sam): remove validate: false once PDSes have the new lexicon
       const result = await getAgent().api.com.atproto.repo.putRecord({
+        repo: currentAccount.did,
         collection: 'chat.bsky.actor.declaration',
         rkey: 'self',
-        repo: currentAccount.did,
         validate: false,
         record: {
           $type: 'chat.bsky.actor.declaration',
@@ -62,3 +62,23 @@ export function useUpdateActorDeclaration({
     },
   })
 }
+
+// for use in the settings screen for testing
+export function useDeleteActorDeclaration() {
+  const {currentAccount} = useSession()
+  const {getAgent} = useAgent()
+
+  return useMutation({
+    mutationFn: async () => {
+      if (!currentAccount) throw new Error('Not logged in')
+      // TODO(sam): remove validate: false once PDSes have the new lexicon
+      const result = await getAgent().api.com.atproto.repo.deleteRecord({
+        repo: currentAccount.did,
+        collection: 'chat.bsky.actor.declaration',
+        rkey: 'self',
+        validate: false,
+      })
+      return result
+    },
+  })
+}