
import Log from './LogTools'


//Обертка для запросов к базе
//URL - 
//Methid : Get Post
//data: данные
export default function ApiQuery(url, method, data){
    Log("ApiQuery", "query to " + url);
    //let json = JSON.stringify(data);
    //debugger;
    return fetch(
        url,
            {
                method: method,
                headers: {
                    'Content-Type': 'application/json'
                },
                credentials: 'include',
                body: JSON.stringify(data)
            }
    ).then(function(response){
        return response.json();
    });
}