about summary refs log tree commit diff
path: root/MatrixRoomUtils.Web/Pages/Rooms/Index.razor
blob: d88d5b2aefdcf1b6b6040727351a39546f196906 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
@page "/Rooms"
@using MatrixRoomUtils.Core.StateEventTypes
@using MatrixRoomUtils.Core.StateEventTypes.Spec
<h3>Room list</h3>

@if (Rooms is not null) {
    <RoomList Rooms="Rooms" GlobalProfile="@GlobalProfile"></RoomList>
}


@code {

    private List<RoomInfo> Rooms { get; set; }
    private ProfileResponseEventData GlobalProfile { get; set; }

    protected override async Task OnInitializedAsync() {
        var hs = await MRUStorage.GetCurrentSessionOrNavigate();
        if (hs is null) return;
        GlobalProfile = await hs.GetProfile(hs.WhoAmI.UserId);
        Rooms = (await hs.GetJoinedRooms()).Select(x => new RoomInfo() { Room = x }).ToList();

        await base.OnInitializedAsync();
    }

}