1
0
mirror of https://github.com/tooot-app/app synced 2025-05-17 03:59:41 +02:00

Fix some weird errors

This commit is contained in:
xmflsct 2022-08-19 11:58:49 +02:00
parent 16dfcec9f2
commit 1507059241
2 changed files with 17 additions and 17 deletions

View File

@ -54,13 +54,13 @@ const contextMenuStatus = ({
message: t('common:message.error.message', { message: t('common:message.error.message', {
function: t(`status.${theFunction}.action`) function: t(`status.${theFunction}.action`)
}), }),
...(err.status && ...(err?.status &&
typeof err.status === 'number' && typeof err.status === 'number' &&
err.data && err.data &&
err.data.error && err.data.error &&
typeof err.data.error === 'string' && { typeof err.data.error === 'string' && {
description: err.data.error description: err.data.error
}) })
}) })
queryClient.setQueryData(queryKey, oldData) queryClient.setQueryData(queryKey, oldData)
} }
@ -70,7 +70,7 @@ const contextMenuStatus = ({
getInstanceAccount, getInstanceAccount,
(prev, next) => prev.id === next.id (prev, next) => prev.id === next.id
) )
const ownAccount = instanceAccount?.id === status?.account.id const ownAccount = instanceAccount?.id === status?.account?.id
if (ownAccount) { if (ownAccount) {
const accountMenuItems: ContextMenuAction[] = [ const accountMenuItems: ContextMenuAction[] = [

View File

@ -38,26 +38,26 @@ const ProfileAvatarHeader: React.FC<Props> = ({ type, messageRef }) => {
? { width: 400, height: 400 } ? { width: 400, height: 400 }
: { width: 1500, height: 500 } : { width: 1500, height: 500 }
}) })
if (!image[0].uri) { if (image[0].uri) {
mutation.mutate({
theme,
messageRef,
message: {
text: `me.profile.root.${type}.title`,
succeed: true,
failed: true
},
type,
data: image[0].uri
})
} else {
displayMessage({ displayMessage({
ref: messageRef, ref: messageRef,
message: t('screenTabs:me.profile.mediaSelectionFailed'), message: t('screenTabs:me.profile.mediaSelectionFailed'),
theme: theme, theme: theme,
type: 'error' type: 'error'
}) })
return
} }
mutation.mutate({
theme,
messageRef,
message: {
text: `me.profile.root.${type}.title`,
succeed: true,
failed: true
},
type,
data: image[0].uri
})
}} }}
/> />
) )