const axios = require('axios');

export default {
    queryAllHostPageable(page, size, callback) {
        axios.get('/api/host/' + page + '/' + size).then((response) => {
            callback(response);
        }).catch(error=>{
            console.log(error);
        })
	},
	queryAllHostCount(callback) {
        axios.get('/api/host/count').then((response) => {
            callback(response);
        }).catch(error=>{
            console.log(error);
        })
	},
	queryAllHost(callback) {
        axios.get('/api/host').then((response) => {
            callback(response);
        }).catch(error=>{
            console.log(error);
        })
	},
    saveHost(host, callback) {
        axios.post('/api/host', host).then((response) => {
            callback(response);
        })
    },
    delHosts(hosts, callback) {
        axios.delete('/api/host', { data: hosts })
            .then(response => callback(response))
            .catch(function (error) { console.log(error) })
    },
    updateHost(host, callback) {
        axios.put('/api/host', host).then((response) => {
            callback(response);
        })
    }   
}