From e372cac9aed26889590876ce7975169c26cd2439 Mon Sep 17 00:00:00 2001 From: Babak Alizadeh Date: Fri, 26 Sep 2025 02:05:13 +0330 Subject: [PATCH] bug fix in permissions --- hesabixUI/hesabix_ui/lib/main.dart | 13 ++++++++++++- .../lib/pages/business/business_shell.dart | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/hesabixUI/hesabix_ui/lib/main.dart b/hesabixUI/hesabix_ui/lib/main.dart index 4ad909d..0eb0819 100644 --- a/hesabixUI/hesabix_ui/lib/main.dart +++ b/hesabixUI/hesabix_ui/lib/main.dart @@ -70,6 +70,8 @@ class _MyAppState extends State { final themeController = ThemeController(); await themeController.load(); final authStore = AuthStore(); + // بایند کردن AuthStore قبل از load برای ارسال هدر Authorization در درخواست‌های اولیه + ApiClient.bindAuthStore(authStore); await authStore.load(); // تنظیم کنترلرها @@ -251,8 +253,17 @@ class _MyAppState extends State { final themeController = _themeController!; print('🔍 BUILD DEBUG: All controllers loaded, creating main router'); + // حفظ URL فعلی مرورگر هنگام سوئیچ از لودینگ به روتر اصلی + final currentInitialLocation = () { + final base = Uri.base; + final path = base.path.isNotEmpty ? base.path : '/'; + final query = base.hasQuery ? '?${base.query}' : ''; + final fragment = base.fragment.isNotEmpty ? '#${base.fragment}' : ''; + return '$path$query$fragment'; + }(); + final router = GoRouter( - initialLocation: '/', + initialLocation: currentInitialLocation, redirect: (context, state) async { final currentPath = state.uri.path; final fullUri = state.uri.toString(); diff --git a/hesabixUI/hesabix_ui/lib/pages/business/business_shell.dart b/hesabixUI/hesabix_ui/lib/pages/business/business_shell.dart index 534dc87..fdc1b86 100644 --- a/hesabixUI/hesabix_ui/lib/pages/business/business_shell.dart +++ b/hesabixUI/hesabix_ui/lib/pages/business/business_shell.dart @@ -988,6 +988,7 @@ class _BusinessShellState extends State { context.pop(); onSelectChild(i, item.children!.indexOf(child)); }, + ); }).toList(), ); }