I am looking to migrate the below method to Angular 7. The issue I am facing is that the data is not being set to the params. Can someone help me figure out why it's not working? It's showing an error message:
Error TS2300: Duplicate identifier 'params'.
updateParamsWithAuth(paramsToSet: HttpParams, appKey: string, fieldToUpdate: string) {
let authToken;
if (appKey && appKey.length > 0) {
authToken = this.getAccessTokenFromSession();
} else {
authToken = this.getRSTokenFromSession();
if (fieldToUpdate === this.FIELD_ACCESS_TOKEN) {
fieldToUpdate = this.FIELD_RS_TOKEN;
}
}
// paramsToSet.set(fieldToUpdate, authToken);
let params = new HttpParams().set(fieldToUpdate, authToken);
return params;
}