Success dialog and Failed dialog changes with VisitorPasswordDialog

This commit is contained in:
mohammad
2024-08-23 22:16:48 +03:00
parent f5a7441b3c
commit cf1a21e121
19 changed files with 792 additions and 785 deletions

View File

@ -1,4 +1,3 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
@ -8,9 +7,7 @@ import 'package:syncrow_web/services/api/http_service.dart';
import 'package:syncrow_web/utils/constants/api_const.dart';
class AuthenticationAPI {
static Future<Token> loginWithEmail({required var model}) async {
print('model=$model');
final response = await HTTPService().post(
path: ApiEndpoints.login,
body: model.toJson(),
@ -46,19 +43,15 @@ class AuthenticationAPI {
},
showServerMessage: true,
expectedResponseModel: (json) {
print('object==$json');
return 30;
}
);
return 30;
} on DioException catch (e) {
if (e.response != null) {
if (e.response!.statusCode == 400) {
// Handle 400 Bad Request
final errorData = e.response!.data;
String errorMessage = errorData['message'];
debugPrint('Unexpected Error: $errorMessage');
if(errorMessage=='User not found'){
return 1;
}else{
@ -87,8 +80,6 @@ class AuthenticationAPI {
body: {"email": email, "type": "PASSWORD", "otpCode": otpCode},
showServerMessage: true,
expectedResponseModel: (json) {
print('json=$json');
if (json['message'] == 'Otp Verified Successfully') {
return true;
} else {
@ -99,12 +90,9 @@ class AuthenticationAPI {
}on DioException catch (e){
if (e.response != null) {
if (e.response!.statusCode == 400) {
// Handle 400 Bad Request
final errorData = e.response!.data;
String errorMessage = errorData['message'];
debugPrint('Unexpected Error: $errorMessage');
return errorMessage;
}
} else {
debugPrint('Error: ${e.message}');