ShiftScheduler/Client/Shared/AuthHeader.razor
copilot-swe-agent[bot] 2443cc06a7 Add Google authentication with authorized email configuration
Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com>
2025-08-26 04:15:48 +00:00

32 lines
No EOL
723 B
Text

@inject HttpClient Http
@inject IJSRuntime JSRuntime
<div class="auth-header">
<div class="user-info">
Welcome, @Email
</div>
<button class="btn btn-outline-danger logout-btn" @onclick="Logout">
Sign Out
</button>
</div>
@code {
[Parameter] public string Email { get; set; } = string.Empty;
[Parameter] public EventCallback OnLogout { get; set; }
private async Task Logout()
{
try
{
await Http.PostAsync("api/auth/logout", null);
}
catch (Exception)
{
// Ignore errors, just redirect
}
finally
{
await JSRuntime.InvokeVoidAsync("window.location.reload");
}
}
}