Newer
Older
import axios from 'axios';
import store from '../store'
const baseUrl = store.state.configuration.VUE_APP_DJANGO_API_BASE;
const featureAPI = {
async getFeatureEvents(featureId) {
const response = await axios.get(
`${baseUrl}features/${featureId}/events/`
);
if (
response.status === 200 &&
response.data
) {
return response.data;
} else {
return null;
}
},
async getFeatureAttachments(featureId) {
const response = await axios.get(
`${baseUrl}features/${featureId}/attachments/`
);
if (
response.status === 200 &&
response.data
) {
return response.data;
} else {
return null;
}
},
async postComment({ featureId, comment }) {
`${baseUrl}features/${featureId}/comments/`, { comment }
);
if (
response.status === 201 &&
async postCommentAttachment({ featureId, file, fileName, commentId, title }) {
let formdata = new FormData();
formdata.append("file", file, fileName);
formdata.append("title", title);
const response = await axios.put(
`${baseUrl}features/${featureId}/comments/${commentId}/upload-file/`, formdata
);
if (
response.status === 200 &&
response.data
) {
async getFeatureLinks(featureId) {
const response = await axios.get(
`${baseUrl}features/${featureId}/feature-links/`
);
if (
response.status === 200 &&
response.data
) {
return response.data;
} else {
return null;
}
},
async getFeaturesBlob(url) {
const response = await axios
.get(url, { responseType: "blob" })
if (
response.status === 200 &&
response.data
) {
return response.data;
} else {
return null;
}
},