initial commit

This commit is contained in:
2026-07-21 14:35:37 +07:00
commit 0027997ff9
798 changed files with 59083 additions and 0 deletions
+90
View File
@@ -0,0 +1,90 @@
@page "/account/logout"
@layout AuthenticationLayout
@using Indotalent.Shared.Consts
@using Microsoft.JSInterop
@inject IJSRuntime JSRuntime
<PageTitle>Sign Out - @GlobalConsts.AppInitial</PageTitle>
<div class="logout-container">
<div class="logout-icon-wrapper">
<div class="logout-icon-circle">
<MudIcon Icon="@Icons.Material.Filled.ExitToApp"
Style="font-size: 3rem; color: #DB2777;" />
</div>
</div>
<div class="logout-title">Sign Out</div>
<div class="logout-desc">Are you sure you want to sign out of your account?</div>
<button type="button"
class="btn-primary-custom"
disabled="@isLoggingOut"
@onclick="Logout">
@if (isLoggingOut)
{
<MudProgressCircular Size="Size.Small" Indeterminate="true" Color="Color.Inherit" />
<span>Processing...</span>
}
else
{
<span>Sign Out</span>
}
</button>
<a href="/" class="btn-cancel" style="margin-top:0.75rem;">Cancel</a>
</div>
@code {
private bool isLoggingOut;
private async Task Logout()
{
isLoggingOut = true;
StateHasChanged();
var result = await JSRuntime.InvokeAsync<ApiJSRuntimeResponse>("apiAccountLogout");
if (result.Status == 200)
{
Snackbar.Add("Successfully signed out!", Severity.Success);
await Task.Delay(500);
Navigation.NavigateTo("/", forceLoad: true);
}
else
{
Snackbar.Add(result.Title ?? "Failed to logout.", Severity.Error);
await Task.Delay(500);
}
isLoggingOut = false;
StateHasChanged();
}
private class ApiJSRuntimeResponse
{
public int? Status { get; set; }
public string? Title { get; set; }
}
}
<script>
window.apiAccountLogout = async () => {
try {
const response = await fetch('/api/account/signout', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
credentials: 'include'
});
if (!response.ok) {
throw new Error('Unknown error occurred');
}
return { status: 200, title: 'Success user logout' };
} catch (error) {
return { status: 500, title: 'Server / Network error' };
}
};
</script>