import axios from 'axios'

export default {

    async projectCreateNum() {
        try{
            const result = await axios.get('/projectCreateNum')
            return result.data
        } catch (error) {            
            return error.message
        } 
    },

    async projectCreate(data) {
        try{
            const result = await axios.post('/projectCreate',data)
            return result
        } catch (error) {            
            return error.message
        } 
    },


    async projectCapture (data) {
        try{
            const result = await axios.get('/requestManager',{ params: data })
            return result
        } catch (error) {            
            return error.message
        } 
    },
    // axios.get('/neuroCapture',{ params: param })

    projectUpdate (data) {
        return new Promise((resolve,reject) =>{
            // axios.post('/projectModify',{ params: data })
            axios.post('/projectUpdate',data)
                .then(({data}) => {
                    resolve(data)})
                .catch((error) => {
                    reject(new Error(`${error} 요청 실패입니다.`));
            })
        })
    },

    projectRemove (data) {
        return new Promise((resolve,reject) =>{
            // axios.post('/projectModify',{ params: data })
            axios.post('/projectUpdate',data)
                .then(({data}) => {
                    resolve(data)})
                .catch((error) => {
                    reject(new Error(`${error} 요청 실패입니다.`));
            })
        })
    }        
} 