diff --git a/src/services/tenantService.js b/src/services/tenantService.js index 16dac4b..1c546f6 100644 --- a/src/services/tenantService.js +++ b/src/services/tenantService.js @@ -1,12 +1,9 @@ import axios from "axios"; - - export default { - addTenant(tenant){ - const url='http://localhost:8080/addTenant' - console.log("hahahhaahhha"+tenant.phone); - const data={ + addTenant(tenant) { + const url = '/api/tenant/addTenant' + const data = { symbol: tenant.symbol, contact: tenant.contact, phone: tenant.phone, @@ -15,35 +12,32 @@ export default { } return axios.post(url, data) .then(response => { - if(response.data!=null){ + if (response.data != null) { alert("新增成功"); - }else + } else alert("新增失败"); - location.href="/tenantManagement"; + location.href = "/tenantManagement"; }); }, - getAll(){ - const url='http://localhost:8080/getAllTenant' - return axios.get(url) - .then(response => { - return response.data; - }); + async getAll() { + const url = '/api/tenant/getAllTenant' + const response = await axios.get(url) + return response.data; }, - update(tenant){ - const url='http://localhost:8080/updateTenant'; - console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+tenant); - return axios.post(url,tenant) + update(tenant) { + const url = '/api/tenant/updateTenant'; + return axios.post(url, tenant) .then(response => { }); }, - delete(tenant){ - const url='http://localhost:8080/deleteTenant'; - return axios.post(url,tenant) + delete(tenant) { + const url = '/api/tenant/deleteTenant'; + return axios.post(url, tenant) .then(response => { }); }