bug fix in permissions

This commit is contained in:
Hesabix 2025-09-26 02:05:13 +03:30
parent 2e0c68967b
commit e372cac9ae
2 changed files with 13 additions and 1 deletions

View file

@ -70,6 +70,8 @@ class _MyAppState extends State<MyApp> {
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<MyApp> {
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();

View file

@ -988,6 +988,7 @@ class _BusinessShellState extends State<BusinessShell> {
context.pop();
onSelectChild(i, item.children!.indexOf(child));
},
);
}).toList(),
);
}