const $ = require('jquery');
const Promise  = require('bluebird');


const request  = function(method,path,data) {
	
	return new Promise((resolve,reject) => {

		let url = '/' + path;
		let body;
		$.ajax({
			url:url,
			data:data,
			dataType:'json',
			method:method,
			success:(resp) =>{
				resolve(resp);
			},
			error:(resp) =>{
				console.dir('error resp',JSON.stringfy(resp));
				resolve(resp);
			}

		})

	});
}

module.exports = request;