I m trying to rewrite an Ajax call in Angular. But getting always 401 Unauthorized. When i run the Ajax call, it works perfectly. Any idea how can i transfrom it to a Angular http request ? Thanks...
send(project) {
        let self = this;
        self.tasksURI = 'http://xxxx:xxxx/xx/xx/' + project + '/_apis/build/builds'
        self.PAT = 'xxxxxxxxxxxxxxxxxxxxx'
        self.ajax = function (uri, method, data) {
            var request = {
                url: uri,
                type: method,
                contentType: "application/json",
                accepts: "application/json",
                cache: false,
                dataType: 'json',
                data: JSON.stringify(data),
                beforeSend: function (xhr) {
                    xhr.setRequestHeader("Authorization", "Basic " + btoa("" + ":" + "xxxxxxxxxx"));
                },
                error: function (jqXHR) {
                    console.log("ajax error " + jqXHR);
                }
            };
            return $.ajax(request);
        }
        self.ajax(self.tasksURI, 'GET').done((data) => {
            console.log(data)
        });