Added Error handling

This commit is contained in:
Mohammad Salameh
2024-03-10 08:56:06 +03:00
parent d70c370c2e
commit 5a7787b42d
7 changed files with 37 additions and 128 deletions

View File

@ -35,106 +35,4 @@ class AuthenticationAPI {
debugPrint("response: $response");
return response;
}
// static Future<SuccessResponse> updateUserInfo(
// Map<String, dynamic> data) async {
// final response = await HTTPService().postRequest(
// path: APIConstants.updateUserInfo,
// body: data,
// expectedResponseModel: (json) {
// SuccessResponse token = SuccessResponse.fromJson(json);
// return token;
// });
// return response;
// }
//
// static Future<LoginWithPhoneResponse> loginWithPhone(
// {required LoginWithPhone data, String? recaptchaToken}) async {
// final response = await HTTPService().postRequest(
// path: APIConstants.loginWithChannel,
// body: data.toJson(),
// options: Options(headers: {
// 'captcha-token': recaptchaToken,
// 'captcha-site-key': Platform.isAndroid
// ? dotenv.env['RECAPTCH_ANDROID_SITE_KEY'] ?? ''
// : dotenv.env['RECAPTCH_IOS_SITE_KEY'] ?? ''
// }),
// expectedResponseModel: (json) {
// LoginWithPhoneResponse result = LoginWithPhoneResponse.fromJson(json);
// return result;
// });
// return response;
// }
//
// static Future<List<dynamic>> countryCodes() async {
// final response = await HTTPService().postRequest(
// path: APIConstants.getCountyCode,
// expectedResponseModel: (json) {
// List<dynamic> result = json.toList();
// return result;
// });
// return response;
// }
//
// static Future<bool> sendNotificationToken({
// required Map<String, String> data,
// }) async {
// final response = await HTTPService().postRequest(
// path: APIConstants.notificationToken,
// body: data,
// showServerMessage: false,
// expectedResponseModel: (json) {
// bool checked = false;
// if (json != null) {
// if (json['success']) {
// checked = true;
// }
// }
// return checked;
// });
// return response;
// }
//
// static Future<bool> logout() async {
// final response = await HTTPService().postRequest(
// path: APIConstants.logout,
// expectedResponseModel: (json) {
// bool checked = false;
// // print(json);
// if (json != null) {
// if (json['success']) {
// checked = true;
// }
// }
// return checked;
// });
// return response;
// }
//
// static Future<bool> deleteAccount() async {
// final response = await HTTPService().postRequest(
// path: APIConstants.deleteAccount,
// expectedResponseModel: (json) {
// bool checked = false;
// if (json != null) {
// if (json['success']) {
// checked = true;
// }
// }
// return checked;
// });
// return response;
// }
// static Future<Token> refreshToken(Map<String, dynamic> data) async {
// final response = await HTTPService().postRequest(
// path: APIConstants.refreshToken,
// showServerMessage: false,
// body: data,
// expectedResponseModel: (json) {
// Token token = Token.fromJson(json);
// return token;
// });
// return response;
// }
}