Success dialog and Failed dialog changes with VisitorPasswordDialog

This commit is contained in:
mohammad
2024-08-23 22:25:09 +03:00
parent cf1a21e121
commit 820da1ecfb

View File

@ -246,12 +246,18 @@ class VisitorPasswordBloc
passwordName: event.passwordName); passwordName: event.passwordName);
if (res == true) { if (res == true) {
emit(SuccessState()); emit(SuccessState());
emit(TableLoaded(data)); }else {
throw Exception('Failed to create password');
} }
emit(TableLoaded(data));
} catch (e) { } catch (e) {
emit(FailedState(e.toString())); emit(FailedState(e.toString()));
} Navigator.pop(event.context!);
stateDialog(
context: event.context!,
message: e.toString(),
title: 'Something Wrong'); }
} }
//offline password //offline password
@ -266,10 +272,18 @@ class VisitorPasswordBloc
passwordName: event.passwordName); passwordName: event.passwordName);
if (res == true) { if (res == true) {
emit(SuccessState()); emit(SuccessState());
emit(TableLoaded(data)); }else {
throw Exception('Failed to create password');
} }
emit(TableLoaded(data));
} catch (e) { } catch (e) {
emit(FailedState(e.toString())); emit(FailedState(e.toString()));
Navigator.pop(event.context!);
stateDialog(
context: event.context!,
message: e.toString(),
title: 'Something Wrong');
} }
} }
@ -288,11 +302,18 @@ class VisitorPasswordBloc
); );
if (res == true) { if (res == true) {
emit(SuccessState()); emit(SuccessState());
emit(TableLoaded(data)); }else {
throw Exception('Failed to create password');
} }
emit(TableLoaded(data));
} catch (e) { } catch (e) {
emit(FailedState(e.toString())); emit(FailedState(e.toString()));
} Navigator.pop(event.context!);
stateDialog(
context: event.context!,
message: e.toString(),
title: 'Something Wrong'); }
} }
void selectDevice( void selectDevice(