I am trying to append token in my custom url In backend. But my Url append proper .It becomes 'http://localhost:4200/UrlDatasource'.
export class CustomAdaptor extends ODataV4Adaptor {
constructor(private constantUrl: ConstantURL) {
super();
}
beforeSend(dm: DataManager, request: XMLHttpRequest) {
// this.token(dm, request);
const uuid = localStorage.getItem('uuid');
const token = localStorage.getItem('token');
request.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
request.setRequestHeader('Authorization', `Bearer ${token}:${uuid}`);
// request.open("GET", this.constantUrl.ipUrl, true);
}
// async token(dm: DataManager, request: XMLHttpRequest) {
// const uuid = localStorage.getItem('uuid');
// // let token = await (await Auth.currentSession()).getAccessToken().getJwtToken();
// // localStorage.setItem
// const token = localStorage.getItem('token');
// dm.dataSource.headers = [{ 'Authorization': `Bearer ${token}:${uuid}` }]; // setting header \
// }
}
With the following method
private dataManager: DataManager = new DataManager({
url: this.constant.ipUrl + 'calendar/',
crudUrl: this.constant.ipUrl + 'calendar/',
adaptor: new CustomAdaptor(this.constant),
crossDomain: true
});
So could you please help me , how to append Custom URL with token
Thank you