Skip to content

Commit

Permalink
feat: use deduced baseUrl for app runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
KaiVandivier committed Feb 23, 2024
1 parent e85ee4c commit 2e194c7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion adapter/src/components/ServerVersionProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { getBaseUrlByAppName, setBaseUrlByAppName } from '@dhis2/pwa'
import PropTypes from 'prop-types'
import React, { useEffect, useState } from 'react'
import { get } from '../utils/api.js'
import { getBaseUrl } from '../utils/getBaseUrl.js'
import { parseDHIS2ServerVersion, parseVersion } from '../utils/parseVersion.js'
import { LoadingMask } from './LoadingMask.js'
import { LoginModal } from './LoginModal.js'
Expand Down Expand Up @@ -150,13 +151,15 @@ export const ServerVersionProvider = ({

const serverVersion = parseDHIS2ServerVersion(systemInfo.version)
const realApiVersion = serverVersion.minor
// ultimately, use an absolute URL based on hosted location
const finalBaseUrl = getBaseUrl(baseUrl)

return (
<Provider
config={{
appName,
appVersion: parseVersion(appVersion),
baseUrl,
baseUrl: finalBaseUrl,
apiVersion: apiVersion || realApiVersion,
serverVersion,
systemInfo,
Expand Down

0 comments on commit 2e194c7

Please sign in to comment.