@inherits LayoutComponentBase @using BlazorWebAssembly.Services @using Microsoft.AspNetCore.Components.Authorization @inject ThemeService ThemeService @inject AuthenticationStateProvider AuthStateProvider @inject IJSRuntime JS @inject LibraryApiClient ApiClient Logout @Body LibraryLuxe Home Membership Features About Us Contact Sign In Get Started @Body @code { protected override async Task OnInitializedAsync() { await ThemeService.InitializeAsync(); } protected override async Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { var authState = await AuthStateProvider.GetAuthenticationStateAsync(); var user = authState.User; if (user.Identity?.IsAuthenticated == true) { try { var token = await JS.InvokeAsync("getFcmToken"); if (!string.IsNullOrEmpty(token)) { await ApiClient.UpdateFcmTokenAsync(token); } } catch (Exception ex) { Console.WriteLine($"FCM Token Error: {ex.Message}"); } } } } }