add new router

This commit is contained in:
2025-09-10 13:35:44 +02:00
parent a7d5a65edd
commit b2e26add52

View File

@@ -73,6 +73,7 @@ class MihGoRouter {
MihGoRouterPaths.forgotPassword, MihGoRouterPaths.forgotPassword,
MihGoRouterPaths.resetPassword, MihGoRouterPaths.resetPassword,
MihGoRouterPaths.aboutMih, MihGoRouterPaths.aboutMih,
MihGoRouterPaths.businessProfileView,
]; ];
KenLogger.success( KenLogger.success(
"Redirect Check: ${state.fullPath}, isUserSignedIn: $isUserSignedIn"); "Redirect Check: ${state.fullPath}, isUserSignedIn: $isUserSignedIn");
@@ -81,7 +82,8 @@ class MihGoRouter {
} }
if (isUserSignedIn && if (isUserSignedIn &&
unauthenticatedPaths.contains(state.fullPath) && unauthenticatedPaths.contains(state.fullPath) &&
state.fullPath != MihGoRouterPaths.aboutMih) { state.fullPath != MihGoRouterPaths.aboutMih &&
state.fullPath != MihGoRouterPaths.businessProfileView) {
return MihGoRouterPaths.mihHome; return MihGoRouterPaths.mihHome;
} }
return null; // Stay on current route return null; // Stay on current route
@@ -209,9 +211,11 @@ class MihGoRouter {
path: MihGoRouterPaths.businessProfileView, path: MihGoRouterPaths.businessProfileView,
builder: (BuildContext context, GoRouterState state) { builder: (BuildContext context, GoRouterState state) {
KenLogger.success("MihGoRouter: businessProfileView"); KenLogger.success("MihGoRouter: businessProfileView");
String? businessId = state.uri.queryParameters['business_id'];
KenLogger.success("businessId: $businessId");
final BusinessViewArguments? args = final BusinessViewArguments? args =
state.extra as BusinessViewArguments?; state.extra as BusinessViewArguments?;
if (args == null) { if (args == null && businessId == null) {
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
context.go(MihGoRouterPaths.mihHome); context.go(MihGoRouterPaths.mihHome);
}); });
@@ -220,6 +224,7 @@ class MihGoRouter {
return MzansiBusinessProfileView( return MzansiBusinessProfileView(
key: UniqueKey(), key: UniqueKey(),
arguments: args, arguments: args,
businessId: businessId,
); );
}, },
), ),