#49 feat: servicios API CRUD de organizations, suppliers, countries, departments, municipalities y getProduct
This commit is contained in:
@@ -18,6 +18,10 @@ class DjangoApi {
|
||||
return http.patch(url, payload).then((r) => r.data);
|
||||
}
|
||||
|
||||
deleteRequest(url) {
|
||||
return http.delete(url).then((r) => r.data);
|
||||
}
|
||||
|
||||
getCustomers() {
|
||||
const url = this.base + "/don_confiao/api/customers/";
|
||||
return this.getRequest(url);
|
||||
@@ -39,6 +43,111 @@ class DjangoApi {
|
||||
return this.patchRequest(url, data);
|
||||
}
|
||||
|
||||
getProduct(productId) {
|
||||
const url = this.base + `/don_confiao/api/products/${productId}/`;
|
||||
return this.getRequest(url);
|
||||
}
|
||||
|
||||
getOrganizations() {
|
||||
const url = this.base + "/don_confiao/api/organizations/";
|
||||
return this.getRequest(url);
|
||||
}
|
||||
|
||||
createOrganization(data) {
|
||||
const url = this.base + "/don_confiao/api/organizations/";
|
||||
return this.postRequest(url, data);
|
||||
}
|
||||
|
||||
updateOrganization(id, data) {
|
||||
const url = this.base + `/don_confiao/api/organizations/${id}/`;
|
||||
return this.patchRequest(url, data);
|
||||
}
|
||||
|
||||
deleteOrganization(id) {
|
||||
const url = this.base + `/don_confiao/api/organizations/${id}/`;
|
||||
return this.deleteRequest(url);
|
||||
}
|
||||
|
||||
getSuppliers() {
|
||||
const url = this.base + "/don_confiao/api/suppliers/";
|
||||
return this.getRequest(url);
|
||||
}
|
||||
|
||||
createSupplier(data) {
|
||||
const url = this.base + "/don_confiao/api/suppliers/";
|
||||
return this.postRequest(url, data);
|
||||
}
|
||||
|
||||
updateSupplier(id, data) {
|
||||
const url = this.base + `/don_confiao/api/suppliers/${id}/`;
|
||||
return this.patchRequest(url, data);
|
||||
}
|
||||
|
||||
deleteSupplier(id) {
|
||||
const url = this.base + `/don_confiao/api/suppliers/${id}/`;
|
||||
return this.deleteRequest(url);
|
||||
}
|
||||
|
||||
getCountries() {
|
||||
const url = this.base + "/don_confiao/api/countries/";
|
||||
return this.getRequest(url);
|
||||
}
|
||||
|
||||
createCountry(data) {
|
||||
const url = this.base + "/don_confiao/api/countries/";
|
||||
return this.postRequest(url, data);
|
||||
}
|
||||
|
||||
updateCountry(id, data) {
|
||||
const url = this.base + `/don_confiao/api/countries/${id}/`;
|
||||
return this.patchRequest(url, data);
|
||||
}
|
||||
|
||||
deleteCountry(id) {
|
||||
const url = this.base + `/don_confiao/api/countries/${id}/`;
|
||||
return this.deleteRequest(url);
|
||||
}
|
||||
|
||||
getDepartments() {
|
||||
const url = this.base + "/don_confiao/api/departments/";
|
||||
return this.getRequest(url);
|
||||
}
|
||||
|
||||
createDepartment(data) {
|
||||
const url = this.base + "/don_confiao/api/departments/";
|
||||
return this.postRequest(url, data);
|
||||
}
|
||||
|
||||
updateDepartment(id, data) {
|
||||
const url = this.base + `/don_confiao/api/departments/${id}/`;
|
||||
return this.patchRequest(url, data);
|
||||
}
|
||||
|
||||
deleteDepartment(id) {
|
||||
const url = this.base + `/don_confiao/api/departments/${id}/`;
|
||||
return this.deleteRequest(url);
|
||||
}
|
||||
|
||||
getMunicipalities() {
|
||||
const url = this.base + "/don_confiao/api/municipalities/";
|
||||
return this.getRequest(url);
|
||||
}
|
||||
|
||||
createMunicipality(data) {
|
||||
const url = this.base + "/don_confiao/api/municipalities/";
|
||||
return this.postRequest(url, data);
|
||||
}
|
||||
|
||||
updateMunicipality(id, data) {
|
||||
const url = this.base + `/don_confiao/api/municipalities/${id}/`;
|
||||
return this.patchRequest(url, data);
|
||||
}
|
||||
|
||||
deleteMunicipality(id) {
|
||||
const url = this.base + `/don_confiao/api/municipalities/${id}/`;
|
||||
return this.deleteRequest(url);
|
||||
}
|
||||
|
||||
getPaymentMethods() {
|
||||
const url =
|
||||
this.base + "/don_confiao/payment_methods/all/select_format";
|
||||
|
||||
Reference in New Issue
Block a user