I found something regarding this, but most examples and explanations are deprecated and it's not applicable to RC1.
import {Injectable} from "@angular/core";
import {Http, HTTP_PROVIDERS, Response, RequestOptions, URLSearchParams} from "@angular/http";
import 'rxjs/add/operator/map';
@Injectable()
export class AuthService {
constructor( private _http: Http ) {}
GetLoggedUser(){
return this._http.get('http://dev/api/v1/current-user')
.map((res:Response) => res.json())
}
}
I need to make this call exactly as this legacy code:
$(document).ready(function() {
jQuery.ajax({
type: 'GET',
url: 'http://dev/api/v1/current-user',
xhrFields: {
withCredentials: true
},
}).done(function(data) {
$('#user').html(JSON.stringify(data));
});
});
So, basically I need to make the call using withCredentials. Any help ?