-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
54 lines (38 loc) · 1.5 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* covid19_dashboard copyright © 2020
* Created by mauromarini on 18/07/2020
* Repository: http://github.com/marinimau/covid19_dashboard
* Location: Baratili San Pietro
*/
import React from 'react';
import Async from 'react-async';
import Records from "./src/logic/dataset";
import {enableScreens} from 'react-native-screens';
import ErrorScreen from "./src/ui/components/loading/error";
import LoadingComponent from "./src/ui/components/loading/loading";
import GlobalContainer from "./src/ui/components/GlobalContainer";
import {retrieveAdministrationData, retrieveDeliveryData} from "./src/logic/retrieve";
enableScreens();
export default function App() {
return (
<Async promiseFn={retrieveAdministrationData}>
{({data, err, isLoading}) => {
if (isLoading) return <LoadingComponent/>
if (err) return <ErrorScreen/>
if (data) Records.setAdministrationRecords(data)
return (
<Async promiseFn={retrieveDeliveryData}>
{({data, err, isLoading}) => {
if (isLoading) return <LoadingComponent/>
if (err) return <ErrorScreen/>
if (data) Records.setDeliveryRecords(data)
return (
<GlobalContainer />
)
}}
</Async>
)
}}
</Async>
);
}