const axios = require('axios');
export default {
    queryPageable(data, page, size, callback) {
        axios.post('/api/target/website/queryPageable/' + page + '/' + size, data).then((response) => {
            callback(response);
        })
    },
    queryCommon(data, page, size, callback) {
        axios.post('/api/target/query/common/' + page + '/' + size, data).then((response) => {
            callback(response);
        })
    },
    deleteMulti(data, callback) {
        axios.post('/api/target/website/deleteAll', data).then((response) => {
            callback(response);
        }).catch((error) => {
            console.log(error)
        })
    },
    delete(data, callback) {
        axios.post('/api/target/website/delete', data).then((response) => {
            callback(response);
        }).catch((error) => {
            console.log(error)
        })
    },
    update(data, callback) {
        axios.post('/api/target/website/update', data).then((response) => {
            callback(response);
        }).catch((error) => {
            console.log(error)
        })
    },
    add(data, callback) {
        axios.post('/api/target/website/add', data).then((response) => {
            callback(response);
        }).catch((error) => {
            console.log(error)
        })
    },
    export(callback) {
        axios.get('/api/target/website/export', {
            responseType: 'blob' // 重要：指定响应类型为blob
        }).then((response) => {
            callback(response);
        }).catch((error) => {
            console.log(error)
        })
    },
    import(formData, callback) {
        axios.post('/api/target/website/import', formData, {
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        }).then((response) => {
            callback(response);
        }).catch((error) => {
            console.log(error)
        })
    }

}