about summary refs log tree commit diff
path: root/src/state/models/profile-view.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/models/profile-view.ts')
-rw-r--r--src/state/models/profile-view.ts12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/state/models/profile-view.ts b/src/state/models/profile-view.ts
index 0988367b6..a6854801c 100644
--- a/src/state/models/profile-view.ts
+++ b/src/state/models/profile-view.ts
@@ -2,8 +2,8 @@ import {makeAutoObservable, runInAction} from 'mobx'
 import {PickedMedia} from 'lib/media/picker'
 import {
   AppBskyActorGetProfile as GetProfile,
-  AppBskyActorProfile as Profile,
   AppBskySystemDeclRef,
+  AppBskyActorUpdateProfile,
 } from '@atproto/api'
 type DeclRef = AppBskySystemDeclRef.Main
 import {extractEntities} from 'lib/strings/rich-text-detection'
@@ -132,9 +132,9 @@ export class ProfileViewModel {
   }
 
   async updateProfile(
-    updates: Profile.Record,
-    newUserAvatar: PickedMedia | undefined,
-    newUserBanner: PickedMedia | undefined,
+    updates: AppBskyActorUpdateProfile.InputSchema,
+    newUserAvatar: PickedMedia | undefined | null,
+    newUserBanner: PickedMedia | undefined | null,
   ) {
     if (newUserAvatar) {
       const res = await apilib.uploadBlob(
@@ -146,6 +146,8 @@ export class ProfileViewModel {
         cid: res.data.cid,
         mimeType: newUserAvatar.mime,
       }
+    } else {
+      updates.avatar = null
     }
     if (newUserBanner) {
       const res = await apilib.uploadBlob(
@@ -157,6 +159,8 @@ export class ProfileViewModel {
         cid: res.data.cid,
         mimeType: newUserBanner.mime,
       }
+    } else {
+      updates.banner = null
     }
     await this.rootStore.api.app.bsky.actor.updateProfile(updates)
     await this.rootStore.me.load()