import axios from "axios";



export default {
    addTenant(tenant){
        const url='http://localhost:8080/addTenant'
        console.log("hahahhaahhha"+tenant.phone);
        const data={
            symbol: tenant.symbol,
            contact: tenant.contact,
            phone: tenant.phone,
            manager: tenant.manager,
            name: tenant.name,
        }
        return axios.post(url, data)
            .then(response => {
                if(response.data!=null){
                    alert("新增成功");
                }else
                    alert("新增失败");
                location.href="/tenantManagement";
            });

    },


    getAll(){
        const url='http://localhost:8080/getAllTenant'
        return axios.get(url)
            .then(response => {
                return response.data;
            });
    },

    update(tenant){
        const url='http://localhost:8080/updateTenant';
        console.log("哈哈哈哈哈哈哈啊哈哈哈哈哈"+tenant);
        return axios.post(url,tenant)
            .then(response => {
            });
    },

    delete(tenant){
        const url='http://localhost:8080/deleteTenant';
        return axios.post(url,tenant)
            .then(response => {
            });
    }

}