// const url = 'http://192.168.1.127:9501/'
const url = 'http://183.131.25.186:9501'
const token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJwaHBlcjY2Ni9qd3QiLCJ1aWQiOjc1LCJ1c2VyX25hbWUiOiIxODIzMzU1NjM2OSIsIm1vYmlsZSI6IjE4MjMzNTU2MzY5IiwiZW1haWwiOiIiLCJsZXZlbF9pZCI6MCwidHlwZV9pZCI6MTAwMDAsImp3dF9zY2VuZSI6ImRlZmF1bHQiLCJqdGkiOiJkZWZhdWx0XzY3MzQ1YThjMTIyNzgwLjU0NjI1Nzc3IiwiaWF0IjoxNzMxNDg0MzAwLCJuYmYiOjE3MzE0ODQzMDAsImV4cCI6MTczMTU3MDcwMH0.IVOrFHTIoWYXjU4cHdK7j2yMHqFgpsznjPCK8wUn3Lg'
import { useFetch } from '#app'

const request = async (route, getData) => {
    return new Promise(async (resolve, reject) => {
        try {
            const {data: fetchedData} = await useFetch(url + route, {
                method: 'POST',
                body: getData,
                headers: {
                    'token': `${token}`
                }
            });
            resolve(fetchedData);
        } catch (error) {
            reject(error);
        }
    });
}

export default request;