-
Notifications
You must be signed in to change notification settings - Fork 13
/
Provider.tsx
39 lines (37 loc) · 1.17 KB
/
Provider.tsx
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
import { AlertsProvider } from '@dhis2/app-service-alerts'
import { ConfigProvider } from '@dhis2/app-service-config'
import { Config } from '@dhis2/app-service-config/build/types/types'
import { DataProvider } from '@dhis2/app-service-data'
import { OfflineProvider } from '@dhis2/app-service-offline'
import React from 'react'
type ProviderInput = {
config: Config
children: React.ReactNode
offlineInterface?: any // temporary until offline service has types
plugin: boolean
parentAlertsAdd: any
showAlertsInPlugin: boolean
}
export const Provider = ({
config,
children,
offlineInterface,
plugin,
parentAlertsAdd,
showAlertsInPlugin,
}: ProviderInput) => (
<ConfigProvider config={config}>
<AlertsProvider
plugin={plugin}
parentAlertsAdd={parentAlertsAdd}
showAlertsInPlugin={showAlertsInPlugin}
>
<DataProvider>
<OfflineProvider offlineInterface={offlineInterface}>
{children}
</OfflineProvider>
</DataProvider>
</AlertsProvider>
</ConfigProvider>
)
Provider.displayName = 'DHIS2RuntimeProvider'