async function get(url) {
    try {
        let res = await fetch(url)
        return await res.json()
    } catch (err) {
        console.log('Request Failed', error)
    }
}
async function post(url, data) {
    try {
        let res = await fetch(url, {
            method: 'POST',
            headers: {
                'Content-Type': 'application/json;charset=utf-8'
            },
            body: JSON.stringify(data)
        })
        return await res.json()
    } catch (err) {
        console.log('Request Failed', error)
    }
}

async function postForm(url, data) {
    try {
        let res = await fetch(url, {
            method: 'POST',
            body: new FormData(data)
        })
        return await res.json()
    } catch (err) {
        console.log('Request Failed', error)
    }
}

export {
    get,
    post,
    postForm
}