37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
import request from '@/utils/request'
|
|
import axios from 'axios'
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
export function listProvisioningBatches(query) {
|
|
return request({ url: '/api/v1/provisioning/batches', method: 'get', params: query })
|
|
}
|
|
|
|
export function getProvisioningBatch(id) {
|
|
return request({ url: `/api/v1/provisioning/batches/${id}`, method: 'get' })
|
|
}
|
|
|
|
export function createProvisioningBatch(data) {
|
|
return request({ url: '/api/v1/provisioning/batches', method: 'post', data })
|
|
}
|
|
|
|
export function executeProvisioningBatch(id, data) {
|
|
return request({ url: `/api/v1/provisioning/batches/${id}/execute`, method: 'post', data })
|
|
}
|
|
|
|
export function retryProvisioningFailures(id, data) {
|
|
return request({ url: `/api/v1/provisioning/batches/${id}/retry-failed`, method: 'post', data })
|
|
}
|
|
|
|
export function retryProvisioningItem(batchId, itemId, data) {
|
|
return request({ url: `/api/v1/provisioning/batches/${batchId}/items/${itemId}/retry`, method: 'post', data })
|
|
}
|
|
|
|
export async function downloadProvisioningBatch(id) {
|
|
const baseURL = String(process.env.VUE_APP_BASE_API || '').replace(/\/$/, '')
|
|
const response = await axios.get(`${baseURL}/api/v1/provisioning/batches/${id}/export`, {
|
|
responseType: 'blob',
|
|
headers: { Authorization: `Bearer ${getToken()}` }
|
|
})
|
|
return response.data
|
|
}
|