diff --git a/src/App.razor.cs b/src/App.razor.cs deleted file mode 100644 index 032d529..0000000 --- a/src/App.razor.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using System.Threading.Tasks; -using Blazored.LocalStorage; -using FrontOffice.Main.Utilities; -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Routing; - -namespace FrontOffice.Main; - -public partial class App -{ - private const string TokenStorageKey = "auth:token"; - - [Inject] private ILocalStorageService LocalStorage { get; set; } = default!; - [Inject] private NavigationManager Navigation { get; set; } = default!; - - private async Task HandleNavigationAsync(NavigationContext context) - { - var relativePath = Navigation.ToBaseRelativePath(context.Path); - if (IsAuthPath(relativePath)) - { - return; - } - - var token = await LocalStorage.GetItemAsync(TokenStorageKey); - if (string.IsNullOrWhiteSpace(token)) - { - context.PreventNavigation(); - - var normalized = NormalizePath(relativePath); - var redirectQuery = string.IsNullOrEmpty(normalized) || normalized == "/" - ? string.Empty - : $"?redirect={Uri.EscapeDataString(normalized)}"; - - Navigation.NavigateTo(RouteConstants.Auth.Phone + redirectQuery, forceLoad: true); - } - } - - private static bool IsAuthPath(string? path) - { - if (string.IsNullOrWhiteSpace(path)) - { - return false; - } - - path = path.TrimStart('/'); - return path.StartsWith("auth", StringComparison.OrdinalIgnoreCase); - } - - private static string NormalizePath(string? path) - { - if (string.IsNullOrWhiteSpace(path)) - { - return string.Empty; - } - - var normalized = path.StartsWith('/') ? path : "/" + path; - return normalized; - } -} diff --git a/src/FrontOffice.Main/Pages/Index.razor b/src/FrontOffice.Main/Pages/Index.razor index e039a47..3ba3545 100644 --- a/src/FrontOffice.Main/Pages/Index.razor +++ b/src/FrontOffice.Main/Pages/Index.razor @@ -2,6 +2,9 @@ خانه -

Hello, world!

- -Welcome to your new app. + + داشبورد فرانت‌آفیس + + پس از ورود با شماره موبایل، می‌توانید وضعیت سفارش‌ها و شبکه کاربری خود را مشاهده کنید. + + diff --git a/src/FrontOffice.Main/Shared/NavMenu.razor b/src/FrontOffice.Main/Shared/NavMenu.razor deleted file mode 100644 index c59c830..0000000 --- a/src/FrontOffice.Main/Shared/NavMenu.razor +++ /dev/null @@ -1,39 +0,0 @@ - - - - -@code { - private bool collapseNavMenu = true; - - private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null; - - private void ToggleNavMenu() - { - collapseNavMenu = !collapseNavMenu; - } -}