'use strict';

var $userData = {};

function request(config, done, fail = null) {
	if(!config.data) config.data = {};
	if($userData.user) config.data.user = $userData.user;
	if($userData.pass) config.data.pass = $userData.pass;
	if($userData.token) {
		config.data.token = $userData.token;
	} else {
		if(Cookies.get("JWT_SVEN"))
			config.data.token = Cookies.get("JWT_SVEN");
	}
	if(fail) $.ajax(config).done(done).fail(fail);
	else $.ajax(config).done(done);
};
