diff options
author | Ansh <anshnanda10@gmail.com> | 2023-03-02 16:53:18 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-02 18:53:18 -0600 |
commit | e592e59f4e339aff48589ba7a6f93209bf31d026 (patch) | |
tree | 2568a58d1bac350d45897df843510d7ecd2b1686 /src/state/models/profile-view.ts | |
parent | aeb04a2ed0b90091f92fd1130bd3d30a76449cb2 (diff) | |
download | voidsky-e592e59f4e339aff48589ba7a6f93209bf31d026.tar.zst |
72-delete-avatar-and-cover (#255)
* allow to delete profile pic * allow for removing banner
Diffstat (limited to 'src/state/models/profile-view.ts')
-rw-r--r-- | src/state/models/profile-view.ts | 12 |
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() |