<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">define(function() {
	var API = {
		method: {
			GET: 'GET',
			PUT: 'PUT',
			POST: 'POST',
			DELETE: 'DELETE'
		},
		get: function(path, data, callback) {
			API._request(API.method.GET, path, data, callback);
		},
		put: function(path, data, callback) {
			API._request(API.method.PUT, path, data, callback);
		},
		post: function(path, data, callback) {
			API._request(API.method.POST, path, data, callback);
		},
		delete: function(path, data, callback) {
			API._request(API.method.DELETE, path, data, callback);
		},
		_request: function(method, path, data, callback) {
			$.ajax({
				url: '/api/' + path,
				dataType: 'json',
				type: method,
				data: data
			}).done(callback).error(function() {
				console.log('error'); // @todo: error handling
			}).always(function() {
				// we can do loader stop here? and loader start above here?
			});
		}
	};
	return API;
});</pre></body></html>