Skip to content

Commit

Permalink
feat: add network to the responses
Browse files Browse the repository at this point in the history
  • Loading branch information
onmax committed Aug 21, 2024
1 parent efab628 commit 1fe5126
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions server/api/vts/health.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface HealthStatus {

isSynced: boolean
flags: HealthFlag[]
network: string
}

function err(error: any) {
Expand All @@ -32,6 +33,8 @@ function err(error: any) {
}

export default defineEventHandler(async (event) => {
const networkName = useRuntimeConfig().public.nimiqNetwork

const rpcClient = getRpcClient()

// Get the latest epoch number in the activity table
Expand Down Expand Up @@ -86,6 +89,7 @@ export default defineEventHandler(async (event) => {
isSynced,
flags,
fetchedEpochs,
network: networkName,
}
consola.info('Health Status:', healthStatus)

Expand Down
4 changes: 3 additions & 1 deletion server/api/vts/index.get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ function err(error: any) {
}

export default defineEventHandler(async (event) => {
const networkName = useRuntimeConfig().public.nimiqNetwork

const rpcClient = getRpcClient()

// TODO Remove this block once scheduled tasks are implemented in NuxtHub
Expand Down Expand Up @@ -72,5 +74,5 @@ export default defineEventHandler(async (event) => {
return err(epochNumberError)

setResponseStatus(event, 200)
return { validators, epochNumber } as const
return { validators, epochNumber, network: networkName } as const
})

0 comments on commit 1fe5126

Please sign in to comment.