rpaschoal / ng-chat

💬 A simple facebook/linkedin lookalike chat module for Angular applications.
MIT License
155 stars 92 forks source link

System.Text.Json.JsonElement' does not contain a definition for 'currentUserId' #174

Closed ghost closed 3 years ago

ghost commented 3 years ago

after integrated ng-chat to my angular app

1) supplied [pollFriendsList]="true" in template 2) in component.ts, userId: string = " " or whatever a string like "xxxxxx" 3) make sure SignalR connect to hub - connected ! 4) remove complaint Observable.throw by changing it to throwError in listFriends() method

listFriends(): Observable<ParticipantResponse[]> { // List connected users to show in the friends list // Sending the userId from the request body as this is just a demo return this.http .post(${SignalRAdapter.serverBaseUrl}listFriends, { currentUserId: this.userId }) .pipe( map((res: any) => res), catchError((error: any) => throwError(error.error || 'Server error')) ); }

5) ng serve to my project

Actual Error:

at CallSite.Target(Closure , CallSite , Object …als\API\Middleware\ExceptionMiddleware.cs:line 28", statusCode: 500, message: "'System.Text.Json.JsonElement' does not contain a definition for 'currentUserId'

Questions: 1) where and how currentUserId is defined in the post request 2) how does the listFriend() get the userId?

rpaschoal commented 3 years ago

Demos are available on the main README: https://github.com/rpaschoal/ng-chat

Sounds more like implementation details.