Skip to content

Commit

Permalink
Add datahub health api
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jul 9, 2024
1 parent 5ae62c0 commit f9bb317
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/services/datahub/health/query.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { env } from '@/env.mjs'
import { createQuery } from '@/subsocial-query'
import axios from 'axios'
import urlJoin from 'url-join'

export const getDatahubHealthQuery = createQuery({
key: 'datahubHealth',
fetcher: async () => {
try {
const res = await axios.get(
urlJoin(
env.NEXT_PUBLIC_DATAHUB_QUERY_URL.replace(/\/graphql\/?$/, ''),
'/healthcheck/status'
)
)
return res.data.operational as boolean
} catch {
return false
}
},
})

0 comments on commit f9bb317

Please sign in to comment.