about summary refs log tree commit diff
path: root/src/state/queries/messages/actor-declaration.ts
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-05-17 20:24:06 +0100
committerGitHub <noreply@github.com>2024-05-17 14:24:06 -0500
commitdd0f57e3e3188389bc8ef364e81e4a00405a9a26 (patch)
tree0d7c2012685185e5a3e3fe942d45058e67e730dc /src/state/queries/messages/actor-declaration.ts
parent115041f4bfa537579deb4b8aa92ddb200de4d48e (diff)
downloadvoidsky-dd0f57e3e3188389bc8ef364e81e4a00405a9a26.tar.zst
[🐴] NUX (#4062)
* remove type assertion

* DMs NUX

* delete button for testing

* tweak styles and copy

* rm log

* style tweaks

* reduce amount of words

* Fix not showing on first load

* Spacing tweaks

---------

Co-authored-by: Eric Bailey <git@esb.lol>
Diffstat (limited to 'src/state/queries/messages/actor-declaration.ts')
-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
+    },
+  })
+}