Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function selectFile(e) {
const formdata = new FormData();
const img = e.target.files[0];
formdata.append('file', e.target.files[0]);
try {
const data = await axios.post(
`/file/v1/files?bucket_name=devops-service&file_name=${img.name.split('.')[0]}`,
formdata,
{
header: { 'Content-Type': 'multipart/form-data' },
},
);
if (data) {
record.set('imgUrl', data);
getBase64(formdata.get('file'), (imgUrl) => {
const ele = document.getElementById('img');
ele.style.backgroundImage = `url(${imgUrl})`;
setImgback(imgUrl);
});
}
} catch (err) {
// asfd
async loadListData({ projectId, page, size, sort, param, env }) {
this.setLoading(true);
const envParam = env ? `env_id=${env}&` : '';
const sortPath = sort
? `&sort=${sort.field || sort.columnKey},${SORTER_MAP[sort.order] || 'desc'}`
: '';
const url = `/devops/v1/projects/${projectId}/notification/page_by_options?${envParam}page=${page}&size=${size}${sortPath}`;
const data = await axios
.post(url, JSON.stringify(param))
.catch((e) => {
this.setLoading(false);
Choerodon.handleResponseError(e);
});
if (handlePromptError(data)) {
const { pageNum, total, pageSize, list } = data;
const pageInfo = {
current: pageNum,
total,
pageSize,
};
this.setListData(list);
this.setPageInfo(pageInfo);
createData = (projectId, data) => axios.post(`/devops/v1/projects/${projectId}/notification`, JSON.stringify(data));
createData(projectId, data) {
if (data.get('resourceId')) {
return axios.put(`/devops/v1/projects/${projectId}/customize_resource`,
data, { headers: { 'Content-Type': 'multipart/form-data' } });
} else {
return axios.post(`/devops/v1/projects/${projectId}/customize_resource`,
data, { headers: { 'Content-Type': 'multipart/form-data' } });
}
},
}));
postKV(projectId, data) {
const { id } = data;
if (id) {
return axios.put(`/devops/v1/projects/${projectId}/secret`, JSON.stringify(data));
} else {
return axios.post(`/devops/v1/projects/${projectId}/secret`, JSON.stringify(data));
}
},
checkEffect(projectId, id) {
return axios.post(`/devops/v1/projects/${projectId}/app_service_instances/list_running_instance?env_id=${id}&page=1&size=10`, JSON.stringify({ params: [], searchParam: {} }));
},