Skip to content

Commit

Permalink
Added handleRefresh function so we can refresh both the inbox or fold…
Browse files Browse the repository at this point in the history
…ers if we detect any errors. This function tries to mirror the logic we had in the previous ErrorComponent that we removed to add the new warning. This change also fixes the linting error.
  • Loading branch information
Matthew Guest - Work authored and Matthew Guest - Work committed Feb 20, 2025
1 parent d5282c8 commit 4fb1073
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ function SecureMessaging({ navigation, route }: SecureMessagingScreen) {
navigateTo('StartNewMessage', { attachmentFileToAdd: {}, attachmentFileToRemove: {} })
}

const handleRefresh = () => {
if (inboxError) {
refetchInbox()
} else if (foldersError) {
refetchFolder()
}
}

const scrollViewProps: VAScrollViewProps = {
scrollViewRef: scrollViewRef,
}
Expand Down Expand Up @@ -182,7 +190,7 @@ function SecureMessaging({ navigation, route }: SecureMessagingScreen) {
variant="warning"
header={t('secureMessaging.inbox.messageDownError.title')}
description={t('secureMessaging.inbox.messageDownError.body')}
secondaryButton={{ label: t('refresh'), onPress: refetchInbox }}
secondaryButton={{ label: t('refresh'), onPress: handleRefresh }}
/>
</Box>
) : (
Expand Down

0 comments on commit 4fb1073

Please sign in to comment.