api integration
This commit is contained in:
@@ -29,8 +29,9 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
|
||||
on<LoginSubmitted>((event, emit) async {
|
||||
if (!formKey.currentState!.validate()) {
|
||||
emit(LoginLoading());
|
||||
emit(
|
||||
const LoginFailure("Login failed. Please check your credentials."));
|
||||
emit(LoginFailure(Globalconst.languageSelected == "en"
|
||||
? "Login failed. Please check your credentials."
|
||||
: "فشل تسجيل الدخول. يرجى التحقق من بيانات الاعتماد الخاصة بك."));
|
||||
return;
|
||||
}
|
||||
emit(LoginLoading());
|
||||
@@ -58,8 +59,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
|
||||
emit(LoginFailure(response.message.toString()));
|
||||
}
|
||||
} else {
|
||||
emit(const LoginFailure(
|
||||
"Login failed. Please check your credentials."));
|
||||
emit(LoginFailure(response.message.toString()));
|
||||
}
|
||||
} catch (e) {
|
||||
emit(LoginFailure(e.toString()));
|
||||
|
||||
@@ -16,6 +16,7 @@ class LoginScreen extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
final SecureStorageService secureStorageService = SecureStorageService();
|
||||
final radioBloc = context.read<RadioBloc>();
|
||||
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
if (fromScreen == "welcome" ||
|
||||
|
||||
@@ -59,6 +59,7 @@ class BottomSection extends StatelessWidget {
|
||||
successToastMessage(context, "login successful !");
|
||||
goRouter.pop();
|
||||
radioBloc.resetSelection();
|
||||
loginbloc.resetFields();
|
||||
await secureStorageService.write('isLoginedIn', "true");
|
||||
goRouter.pushNamed(RouteName.pinScreen, pathParameters: {
|
||||
"fromScreen":
|
||||
|
||||
@@ -197,7 +197,7 @@ class LoginForm extends StatelessWidget {
|
||||
child: FormLabelTextField(
|
||||
hintText: localizations.translate(AppText.enterPassword),
|
||||
title: localizations.translate(AppText.password),
|
||||
type: "password",
|
||||
type: "login-password",
|
||||
textEditingController: loginBloc.passwordTextField,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user