Я пытаюсь реализовать библиотеку ng-chat в своем приложении Angular, но я застрял с заменой данных фиктивного пользователя фактическими данными, которые я получаю из серверной части, я использую ng-chat библиотека, вот фиктивный массив пользователей (библиотека темрейтов):
import { ChatAdapter, IChatGroupAdapter, User, Group, Message, ChatParticipantStatus, ParticipantResponse, ParticipantMetadata, ChatParticipantType, IChatParticipant } from 'ng-chat';
import { Observable, of } from 'rxjs';
import { delay } from "rxjs/operators";
export class Adapter extends ChatAdapter implements IChatGroupAdapter {
public static mockedParticipants: IChatParticipant[] = [
{
participantType: ChatParticipantType.User,
id: 1,
displayName: "Arya Stark",
avatar: "https://66.media.tumblr.com/avatar_9dd9bb497b75_128.pnj",
status: ChatParticipantStatus.Online
},
{
participantType: ChatParticipantType.User,
id: 2,
displayName: "Cersei Lannister",
avatar: null,
status: ChatParticipantStatus.Online
},
{
participantType: ChatParticipantType.User,
id: 3,
displayName: "Daenerys Targaryen",
avatar: "https://68.media.tumblr.com/avatar_d28d7149f567_128.png",
status: ChatParticipantStatus.Busy
},
{
participantType: ChatParticipantType.User,
id: 4,
displayName: "Eddard Stark",
avatar: "https://pbs.twimg.com/profile_images/600707945911844864/MNogF757_400x400.jpg",
status: ChatParticipantStatus.Offline
},
{
participantType: ChatParticipantType.User,
id: 5,
displayName: "Hodor",
avatar: "https://pbs.twimg.com/profile_images/378800000449071678/27f2e27edd119a7133110f8635f2c130.jpeg",
status: ChatParticipantStatus.Offline
},
{
participantType: ChatParticipantType.User,
id: 6,
displayName: "Jaime Lannister",
avatar: "https://pbs.twimg.com/profile_images/378800000243930208/4fa8efadb63777ead29046d822606a57.jpeg",
status: ChatParticipantStatus.Busy
},
{
participantType: ChatParticipantType.User,
id: 7,
displayName: "John Snow",
avatar: "https://pbs.twimg.com/profile_images/3456602315/aad436e6fab77ef4098c7a5b86cac8e3.jpeg",
status: ChatParticipantStatus.Busy
},
{
participantType: ChatParticipantType.User,
id: 8,
displayName: "Lorde Petyr 'Littlefinger' Baelish",
avatar: "http://68.media.tumblr.com/avatar_ba75cbb26da7_128.png",
status: ChatParticipantStatus.Offline
},
{
participantType: ChatParticipantType.User,
id: 9,
displayName: "Sansa Stark",
avatar: "http://pm1.narvii.com/6201/dfe7ad75cd32130a5c844d58315cbca02fe5b804_128.jpg",
status: ChatParticipantStatus.Online
},
{
participantType: ChatParticipantType.User,
id: 10,
displayName: "Theon Greyjoy",
avatar: "https://thumbnail.myheritageimages.com/502/323/78502323/000/000114_884889c3n33qfe004v5024_C_64x64C.jpg",
status: ChatParticipantStatus.Away
}];
}
Я пытался добавить что-то вроде этого:
import { FollowersService } from '@services/followers.service';
static followersService: FollowersService;
public static Participants = Adapter.followersService.getSpecFollowers(JSON.parse(localStorage.getItem('currentUser')).id).subscribe(
(data) => {
Adapter.Participants = data;
});
Но, очевидно, это не работает , Как я могу добавить свой сервис и данные из бэкэнда в этот класс? Любая помощь будет оценена.