adding redirection if user already has a staff
This commit is contained in:
@@ -108,12 +108,19 @@ class _PhoneVerificationPageState extends State<PhoneVerificationPage> {
|
||||
state.mode == AuthMode.signup) {
|
||||
final String message = state.errorMessage ?? '';
|
||||
if (message.contains('staff profile')) {
|
||||
Modular.to.pushReplacementNamed(
|
||||
'./phone-verification',
|
||||
arguments: <String, String>{
|
||||
'mode': AuthMode.login.name,
|
||||
},
|
||||
final ScaffoldMessengerState messenger =
|
||||
ScaffoldMessenger.of(context);
|
||||
messenger.hideCurrentSnackBar();
|
||||
messenger.showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(message),
|
||||
duration: const Duration(seconds: 5),
|
||||
),
|
||||
);
|
||||
Future<void>.delayed(const Duration(seconds: 5), () {
|
||||
if (!mounted) return;
|
||||
Modular.to.navigate('/');
|
||||
});
|
||||
} else if (message.contains('not authorized')) {
|
||||
Modular.to.pop();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user