feat: integration with API Vega Cloud
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { httpRequest } from '~/helpers/http/axios'
|
||||
import logger from '~/plugins/logger'
|
||||
|
||||
export async function sendCommandToThirdParty(topicData: string, payload: string): Promise<void> {
|
||||
try {
|
||||
const response = await httpRequest({
|
||||
method: 'POST',
|
||||
url: '/command',
|
||||
body: {
|
||||
topic: topicData,
|
||||
payload,
|
||||
},
|
||||
})
|
||||
logger.info({ msg: 'Third-party command sent successfully', topic: topicData, status: response.status })
|
||||
} catch (error) {
|
||||
logger.error({ msg: 'Failed to send command to third-party service', topic: topicData, error: (error as Error).message })
|
||||
throw new Error('third_party_command_failed')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user