I am trying to subscribe to an Observable, but everytime I try to subscribe I get this error:
this.authenticateService.getCurrentUser(...).subscribe is not a function at new HomeComponent
My getCurrentUser method looks like this:
getCurrentUser(): Observable<ICurrentUser> {
return new Observable<ICurrentUser>(subscriber => {
from(this.HttpService.get('/user/current')).subscribe(currentUser => {
subscriber.next(currentUser);
});
});
}
The ICurrentUser interface extends from IUser:
interface IUser {
uid: string;
email: string;
firstname: string;
name: string;
language: string;
companyUid: string;
companyName: string;
password?: string;
newPassword?: string;
role: string;
expirationDate: string;
alternativeEmail?: string;
alertSubscription?: boolean;
license?: ILicense;
isLocked: boolean;
props: any;
}
interface ICurrentUser extends IUser {
timeBeforeExpiration: number;
graceLoginsRemaining: number;
usingGraceLogins: boolean;
autologon: boolean;
termsAndAgreementsDate: string; // date
workspaces: number[];
markets: number[];
findInAccessibleOnly: boolean;
}
What I get from API when running the GET request:
{
"uid": "xxxxx-xxxx-xxx-xxx",
"email": "xxxx@xxxx",
"firstname": "xxx",
"name": "xxxx",
"language": "xx",
"companyUid": "xxxxx-xxxx-xxxxx-xxxxx",
"companyName": "xxxx",
"password": null,
"newPassword": null,
"role": "COMPANY_MANAGER",
"expirationDate": null,
"alternativeEmail": null,
"alertSubscription": false,
"license": null,
"isLocked": null,
"props": {
"ff_findInAccessibleOnly": "true",
"ff_timer_module": "false",
"lexprhId": "28936",
"defaultSearchFilters": "{\"keys\":\"*\",\"suggestReference\":null,\"documentTypeIds\":[],\"attributes\":{\"endDateOfApplicability\":[false],\"findInAccessibleOnly\":[false],\"book\":[],\"type\":[\"101\"],\"nature\":[\"163\",\"105\",\"101\",\"100\",\"103\",\"104\",\"106\",\"107\",\"108\",\"159\",\"158\",\"160\",\"109\",\"157\",\"110\",\"149\",\"115\",\"165\",\"114\",\"116\",\"111\",\"112\",\"113\",\"154\",\"155\",\"156\",\"153\",\"164\",\"117\",\"118\",\"119\",\"121\",\"120\",\"122\",\"124\",\"126\",\"129\",\"125\",\"128\",\"127\",\"130\",\"123\",\"135\",\"145\",\"131\",\"150\",\"134\",\"132\",\"136\",\"133\",\"152\",\"138\",\"151\",\"139\",\"140\",\"141\",\"142\",\"143\",\"144\",\"137\",\"146\",\"147\",\"148\"],\"jurisdiction\":[],\"sourceType\":[],\"source\":[],\"guidelineSource\":[],\"workspace\":[],\"domain\":[],\"territory\":[]},\"pagination\":{\"number\":1,\"size\":30,\"sort\":\"RELEVANCE\"},\"quickSearch\":false}"
},
"timeBeforeExpiration": -1,
"graceLoginsRemaining": -1,
"usingGraceLogins": false,
"termsAndAgreementsDate": "2021-06-08T14:48:10.000+00:00",
"workspaces": [
1,
2,
8,
101,
100,
4,
102,
7,
5,
3
],
"markets": [
1,
0
],
"findInAccessibleOnly": false,
"autologon": false
}