diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-11-11 14:15:43 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-11-11 14:15:43 -0600 |
commit | 38ed9a794353ae89c5c311dcecab00f0313ec675 (patch) | |
tree | 1dd289dce051a8bb6f4a4f33bb6540ae73637ce6 /src/state/lib/api.ts | |
parent | fe52d19c485f4cdaec3b35ca31f5e9e7b44ff975 (diff) | |
download | voidsky-38ed9a794353ae89c5c311dcecab00f0313ec675.tar.zst |
Implement profile updates
Diffstat (limited to 'src/state/lib/api.ts')
-rw-r--r-- | src/state/lib/api.ts | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/state/lib/api.ts b/src/state/lib/api.ts index 9bc19b78c..807f257a9 100644 --- a/src/state/lib/api.ts +++ b/src/state/lib/api.ts @@ -138,29 +138,17 @@ export async function unfollow(store: RootStoreModel, followUri: string) { export async function updateProfile( store: RootStoreModel, + did: string, modifyFn: (existing?: Profile.Record) => Profile.Record, ) { - // TODO NOW replaceme const res = await store.api.app.bsky.actor.profile.list({ - user: store.me.did || '', + user: did || '', }) const existing = res.records[0] - if (existing) { - await store.api.app.bsky.actor.profile.put( - { - did: store.me.did || '', - rkey: new AtUri(existing.uri).rkey, - }, - modifyFn(existing.value), - ) - } else { - await store.api.app.bsky.actor.profile.create( - { - did: store.me.did || '', - }, - modifyFn(), - ) - } + await store.api.app.bsky.actor.updateProfile({ + did: did || '', + ...modifyFn(existing?.value), + }) } export async function inviteToScene( |