Home page

This commit is contained in:
mohammad
2024-08-06 11:21:14 +03:00
parent 09dc49b630
commit 1f5a119c60
11 changed files with 521 additions and 665 deletions

View File

@ -1,5 +1,6 @@
import 'dart:convert';
import 'package:syncrow_web/pages/auth/model/region_model.dart';
import 'package:syncrow_web/pages/auth/model/token.dart';
import 'package:syncrow_web/services/api/http_service.dart';
import 'package:syncrow_web/utils/constants/api_const.dart';
@ -17,51 +18,50 @@ class AuthenticationAPI {
return response;
}
static Future forgetPassword({ required var email, required var password}) async {
static Future forgetPassword(
{required var email, required var password}) async {
final response = await HTTPService().post(
path: ApiEndpoints.forgetPassword,
body: {
"email": email,
"password": password
},
body: {"email": email, "password": password},
showServerMessage: true,
expectedResponseModel: (json) {
});
expectedResponseModel: (json) {});
return response;
}
static Future sendOtp({ required var email}) async {
static Future sendOtp({required var email}) async {
final response = await HTTPService().post(
path: ApiEndpoints.sendOtp,
body: {
"email": email,
"type": "VERIFICATION"
},
body: {"email": email, "type": "VERIFICATION"},
showServerMessage: true,
expectedResponseModel: (json) {
print('json===$json');
});
expectedResponseModel: (json) {});
return response;
}
static Future<bool> verifyOtp({ required String email, required String otpCode}) async {
static Future<bool> verifyOtp(
{required String email, required String otpCode}) async {
final response = await HTTPService().post(
path: ApiEndpoints.verifyOtp,
body: {
"email": email,
"type": "VERIFICATION",
"otpCode": otpCode
},
body: {"email": email, "type": "VERIFICATION", "otpCode": otpCode},
showServerMessage: true,
expectedResponseModel: (json) {
print('json===${json['message']}');
if(json['message']=='Otp Verified Successfully'){
return true;
}else{
return false;
}
if (json['message'] == 'Otp Verified Successfully') {
return true;
} else {
return false;
}
});
return response;
}
static Future<List<RegionModel>> fetchRegion() async {
final response = await HTTPService().get(
path: ApiEndpoints.getRegion,
showServerMessage: true,
expectedResponseModel: (json) {
return (json as List).map((zone) => RegionModel.fromJson(zone)).toList();
}
);
return response as List<RegionModel>;
}
}