Skip to content

Commit

Permalink
chore: ensure set in superset is in lower case
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric committed Jan 13, 2025
1 parent f97b84f commit 3cc7019
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/api/superSetGateway.js → src/api/supersetGateway.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useConfig } from '@dhis2/app-service-config'
import { useCallback, useMemo } from 'react'

export const useFetchSuperSetBaseUrl = () => {
export const useFetchSupersetBaseUrl = () => {
const { baseUrl } = useConfig()
const url = useMemo(
() =>
Expand All @@ -14,7 +14,7 @@ export const useFetchSuperSetBaseUrl = () => {
[baseUrl]
)

const fetchSuperSetBaseUrl = useCallback(async () => {
const fetchSupersetBaseUrl = useCallback(async () => {
const response = await fetch(url)
if (!response.ok) {
throw new Error(`Response status: ${response.status}`)
Expand All @@ -24,5 +24,5 @@ export const useFetchSuperSetBaseUrl = () => {
return data.supersetBaseUrl
}, [url])

return fetchSuperSetBaseUrl
return fetchSupersetBaseUrl
}
10 changes: 5 additions & 5 deletions src/components/SystemSettingsProvider.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useDataEngine } from '@dhis2/app-runtime'
import PropTypes from 'prop-types'
import React, { useContext, useState, useEffect, createContext } from 'react'
import { useFetchSuperSetBaseUrl } from '../api/superSetGateway.js'
import { useFetchSupersetBaseUrl } from '../api/supersetGateway.js'
import {
systemSettingsQuery,
renameSystemSettings,
Expand All @@ -13,7 +13,7 @@ export const SystemSettingsCtx = createContext({})
const SystemSettingsProvider = ({ children }) => {
const [settings, setSettings] = useState(null)
const engine = useDataEngine()
const fetchSuperSetBaseUrl = useFetchSuperSetBaseUrl()
const fetchSupersetBaseUrl = useFetchSupersetBaseUrl()

useEffect(() => {
async function fetchData() {
Expand All @@ -34,13 +34,13 @@ const SystemSettingsProvider = ({ children }) => {
}
if (resolvedSystemSettings.embeddedDashboardsEnabled) {
resolvedSystemSettings.supersetBaseUrl =
await fetchSuperSetBaseUrl()
await fetchSupersetBaseUrl()
}

setSettings(resolvedSystemSettings)
}
fetchData()
}, [engine, fetchSuperSetBaseUrl])
}, [engine, fetchSupersetBaseUrl])

return (
<SystemSettingsCtx.Provider
Expand All @@ -60,7 +60,7 @@ SystemSettingsProvider.propTypes = {
export default SystemSettingsProvider

export const useSystemSettings = () => useContext(SystemSettingsCtx)
export const useHasSuperSetSupport = () => {
export const useHasSupersetSupport = () => {
const { embeddedDashboardsEnabled, supersetBaseUrl } = useSystemSettings()
return embeddedDashboardsEnabled && !!supersetBaseUrl
}
Expand Down

0 comments on commit 3cc7019

Please sign in to comment.