Clean up upsertProfile types
This commit is contained in:
@@ -158,29 +158,29 @@ export function useProfileUpdateMutation() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
await agent.upsertProfile(async existing => {
|
await agent.upsertProfile(async existing => {
|
||||||
existing = existing || {}
|
let next: Un$Typed<AppBskyActorProfile.Record> = existing || {}
|
||||||
if (typeof updates === 'function') {
|
if (typeof updates === 'function') {
|
||||||
existing = updates(existing)
|
next = updates(next)
|
||||||
} else {
|
} else {
|
||||||
existing.displayName = updates.displayName
|
next.displayName = updates.displayName
|
||||||
existing.description = updates.description
|
next.description = updates.description
|
||||||
if ('pinnedPost' in updates) {
|
if ('pinnedPost' in updates) {
|
||||||
existing.pinnedPost = updates.pinnedPost
|
next.pinnedPost = updates.pinnedPost
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (newUserAvatarPromise) {
|
if (newUserAvatarPromise) {
|
||||||
const res = await newUserAvatarPromise
|
const res = await newUserAvatarPromise
|
||||||
existing.avatar = res.data.blob
|
next.avatar = res.data.blob
|
||||||
} else if (newUserAvatar === null) {
|
} else if (newUserAvatar === null) {
|
||||||
existing.avatar = undefined
|
next.avatar = undefined
|
||||||
}
|
}
|
||||||
if (newUserBannerPromise) {
|
if (newUserBannerPromise) {
|
||||||
const res = await newUserBannerPromise
|
const res = await newUserBannerPromise
|
||||||
existing.banner = res.data.blob
|
next.banner = res.data.blob
|
||||||
} else if (newUserBanner === null) {
|
} else if (newUserBanner === null) {
|
||||||
existing.banner = undefined
|
next.banner = undefined
|
||||||
}
|
}
|
||||||
return existing
|
return next
|
||||||
})
|
})
|
||||||
await whenAppViewReady(
|
await whenAppViewReady(
|
||||||
agent,
|
agent,
|
||||||
|
|||||||
Reference in New Issue
Block a user