Skip to content

Commit 6ea9414

Browse files
committed
An error is displayed when there is a problem connecting to the backend
1 parent 155d7f1 commit 6ea9414

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/features/Core/screens/BootScreen.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useEffect } from 'react';
1+
import React, { useEffect, useState } from 'react';
22
import { SafeAreaView, View, ActivityIndicator } from 'react-native';
33
import { initStripe } from '@stripe/stripe-react-native';
44
import { hasRequiredKeys, logError } from 'utils';
@@ -20,6 +20,7 @@ const { STRIPE_KEY, APP_IDENTIFIER } = config;
2020
* @component
2121
*/
2222
const BootScreen = ({ navigation }) => {
23+
const [error, setError] = useState(null);
2324
// If the required keys are not provided display the setup warning screen
2425
if (!hasRequiredKeys()) {
2526
return <SetupWarningScreen />;
@@ -54,6 +55,7 @@ const BootScreen = ({ navigation }) => {
5455
}
5556
})
5657
.catch((error) => {
58+
setError(error);
5759
logError(error, '[ Error fetching storefront info! ]');
5860
})
5961
.finally(() => {
@@ -62,6 +64,10 @@ const BootScreen = ({ navigation }) => {
6264
}, 300);
6365
});
6466

67+
if (error) {
68+
return <SetupWarningScreen error={error} />;
69+
}
70+
6571
return (
6672
<SafeAreaView style={tailwind('bg-white')}>
6773
<View style={tailwind('flex items-center justify-center w-full h-full bg-white')}>

0 commit comments

Comments
 (0)