Skip to content

Commit

Permalink
fix: allow env var override of api version (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
amcgee committed Sep 25, 2019
1 parent b737b14 commit dc1b6df
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/simple-app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -923,7 +923,7 @@
integrity sha512-+Rmw+QshbgiBielN7UH4VXfEeSnSj1N3d4HGqf3iekyUXCNdpZX2bD9QrH43KvdfH+lDp71Uh7y3FKEhzSbRLA==

"@dhis2/cli-app-scripts@file:../../cli":
version "1.4.1"
version "1.4.2"
dependencies:
"@babel/core" "^7.6.0"
"@babel/plugin-proposal-class-properties" "^7.4.4"
Expand Down
12 changes: 7 additions & 5 deletions shell/adapter/src/AuthBoundary/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import i18n from '../locales'
import { ScreenCover, CircularLoader } from '@dhis2/ui-core'
import { LoginModal } from './LoginModal'

const settingsQuery = {
userSettings: {
resource: 'userSettings',
},
}

export const AuthBoundary = ({ url, children }) => {
i18n.changeLanguage(window.navigator.language)
const { loading, error, data } = useDataQuery({
userSettings: {
resource: 'userSettings',
},
})
const { loading, error, data } = useDataQuery(settingsQuery)

if (loading) {
return (
Expand Down
4 changes: 2 additions & 2 deletions shell/adapter/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { DataProvider } from '@dhis2/app-runtime'
import { FatalErrorBoundary } from './FatalErrorBoundary'
import { AuthBoundary } from './AuthBoundary'

const App = ({ url, appName, children }) => (
const App = ({ url, apiVersion, appName, children }) => (
<FatalErrorBoundary>
<DataProvider baseUrl={url} apiVersion={32}>
<DataProvider baseUrl={url} apiVersion={apiVersion}>
<HeaderBar appName={appName} />
<AuthBoundary url={url}>{children}</AuthBoundary>
</DataProvider>
Expand Down
2 changes: 1 addition & 1 deletion shell/adapter/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@
integrity sha512-+Rmw+QshbgiBielN7UH4VXfEeSnSj1N3d4HGqf3iekyUXCNdpZX2bD9QrH43KvdfH+lDp71Uh7y3FKEhzSbRLA==

"@dhis2/cli-app-scripts@file:../../cli":
version "1.4.1"
version "1.4.2"
dependencies:
"@babel/core" "^7.6.0"
"@babel/plugin-proposal-class-properties" "^7.4.4"
Expand Down
1 change: 1 addition & 0 deletions shell/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ const D2App = React.lazy(() =>
const appConfig = {
url: process.env.REACT_APP_DHIS2_BASE_URL || 'http:https://localhost:8080',
appName: process.env.REACT_APP_DHIS2_APP_NAME || '',
apiVersion: parseInt(process.env.REACT_APP_DHIS2_API_VERSION) || 32,
}

const App = () => (
Expand Down
File renamed without changes.

0 comments on commit dc1b6df

Please sign in to comment.