aboutsummaryrefslogtreecommitdiff
path: root/src/js/Botleagues.js
blob: f9d34b76a268b1817713adb9b2c347627c13f5df (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function Botleagues(){}

Botleagues.url = 'https://api.local.botleagues.camilstaps.nl';

Botleagues.request = function(user_options, callback) {
    var options = {
        endpoint: null,
        method: 'GET',
        dataType: 'json',
        complete: function(data) {
            callback(data.responseJSON);
        }
    };
    for (var name in user_options) {
        options[name] = user_options[name];
    }

    var url = Botleagues.url + '/' + options['endpoint'];
    delete options['endpoint'];

    jQuery.ajax(url, options);
};

Botleagues.redirect = function(user_options) {
    window.location = Botleagues.url + '/' + user_options['endpoint'];
};