fix: handle null response from Dokploy application.deploy
This commit is contained in:
1 parent
b7deb5c852
commit
6b5d5eefd6
1 file changed
+5
-2
+5
-2
@@ -214,10 +214,13 @@ export function createDokployClient(config: DokployConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function deployApplication(applicationId: string): Promise<{ jobId?: string; status: string }> {
|
async function deployApplication(applicationId: string): Promise<{ jobId?: string; status: string }> {
|
||||||
const res = await call<{ jobId?: string; deployId?: string; status?: string }>('/application.deploy', {
|
const res = await call<Record<string, unknown> | null>('/application.deploy', {
|
||||||
applicationId,
|
applicationId,
|
||||||
})
|
})
|
||||||
return { jobId: res.jobId ?? res.deployId, status: res.status ?? 'deploying' }
|
if (!res) return { jobId: undefined, status: 'deploying' }
|
||||||
|
const jobId = (res.jobId as string) ?? (res.deployId as string) ?? (res.id as string)
|
||||||
|
const status = (res.status as string) ?? 'deploying'
|
||||||
|
return { jobId, status }
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getApplication(applicationId: string): Promise<DokployApp> {
|
async function getApplication(applicationId: string): Promise<DokployApp> {
|
||||||
|
|||||||
Reference in new issue
Block a user