summary refs log tree commit diff
path: root/extra/admin-api/Utilities/Spacebar.Client/Pages/Channels/@me.razor
blob: 3a47c7bf3e7c35b663a2537d4e3b8141805f2d70 (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
26
27
28
29
30
31
32
@* Workaround for Rider "Bad compile constant value" bug *@
@attribute [Route(PageUri)]
@using ArcaneLibs.Blazor.Components.Services
@using Spacebar.Client.Core
@inject JsConsoleService jsConsole

<h3>@@me</h3>
<p>@Client?.ApiHttpClient.BaseAddress</p>
<p>@Client?.Gateway.RawClientWebSocket.State</p>

@foreach (var guild in App.ClientManager.ClientState.Guilds) {
    <span class="code">@guild.Value.Name</span><br/>
}

@code {
    private const string PageUri = "/channels/@me";

    [Parameter, CascadingParameter]
    public required AuthenticatedSpacebarClient? Client {
        get;
        set { field = value; Console.WriteLine("Set client: " + value); }
    }

    protected override async Task OnParametersSetAsync() {
        if (Client == null) return;
        Client.Gateway.OnGatewayMessage.Add(async msg => {
            // await jsConsole.Log("Received gateway message: ", msg);
            // StateHasChanged();
        });
    }

}