@@ -8,20 +8,22 @@ import ImageSVG from '@components/ImageSVG';
8
8
import SafeAreaConsumer from '@components/SafeAreaConsumer' ;
9
9
import Text from '@components/Text' ;
10
10
import TextLink from '@components/TextLink' ;
11
+ import useIsAuthenticated from '@hooks/useIsAuthenticated' ;
11
12
import useLocalize from '@hooks/useLocalize' ;
12
13
import usePageRefresh from '@hooks/usePageRefresh' ;
13
14
import useStyleUtils from '@hooks/useStyleUtils' ;
14
15
import useTheme from '@hooks/useTheme' ;
15
16
import useThemeStyles from '@hooks/useThemeStyles' ;
16
17
import variables from '@styles/variables' ;
17
- import * as Session from '@userActions/Session' ;
18
+ import { signOutAndRedirectToSignIn } from '@userActions/Session' ;
18
19
import CONST from '@src/CONST' ;
19
20
import ErrorBodyText from './ErrorBodyText' ;
20
21
21
22
function GenericErrorPage ( { error} : { error ?: Error } ) {
22
23
const theme = useTheme ( ) ;
23
24
const styles = useThemeStyles ( ) ;
24
25
const StyleUtils = useStyleUtils ( ) ;
26
+ const isAuthenticated = useIsAuthenticated ( ) ;
25
27
const { translate} = useLocalize ( ) ;
26
28
const isChunkLoadError = error ?. name === CONST . CHUNK_LOAD_ERROR || / L o a d i n g c h u n k [ \d ] + f a i l e d / . test ( error ?. message ?? '' ) ;
27
29
const refreshPage = usePageRefresh ( ) ;
@@ -63,13 +65,15 @@ function GenericErrorPage({error}: {error?: Error}) {
63
65
style = { styles . mr3 }
64
66
onPress = { ( ) => refreshPage ( isChunkLoadError ) }
65
67
/>
66
- < Button
67
- text = { translate ( 'initialSettingsPage.signOut' ) }
68
- onPress = { ( ) => {
69
- Session . signOutAndRedirectToSignIn ( ) ;
70
- refreshPage ( ) ;
71
- } }
72
- />
68
+ { isAuthenticated && (
69
+ < Button
70
+ text = { translate ( 'initialSettingsPage.signOut' ) }
71
+ onPress = { ( ) => {
72
+ signOutAndRedirectToSignIn ( ) ;
73
+ refreshPage ( ) ;
74
+ } }
75
+ />
76
+ ) }
73
77
</ View >
74
78
</ View >
75
79
</ View >
0 commit comments