register method
Implementation
Future<bool> register(String name, String email, String mobile,
String password, String org, String designtion) async {
final statusResponse = await ApiService.post(EnvConfig.registerAuth, body: {
"fullName": name,
"email": email,
"mobile": mobile,
"password": password,
"organization": org,
"designation": designtion
});
if (statusResponse == null) {
AppDialogs.showError('Error', 'Empty response from server');
return false;
}
final bool isSuccess = statusResponse['code']?.toString() == '200';
if (!isSuccess) {
Get.snackbar(
statusResponse['type']?.toString() ?? "",
statusResponse['message']?.toString() ?? 'Unknown error',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.red,
duration: const Duration(seconds: 4),
);
/* AppDialogs.showError(
'Failed',
statusResponse['message']?.toString() ?? 'Unknown error',
);*/
return false;
} else {
Get.snackbar(statusResponse['type']?.toString() ?? "",
statusResponse['message']?.toString() ?? 'Unknown error',
snackPosition: SnackPosition.BOTTOM,
backgroundColor: Colors.green,
duration: const Duration(seconds: 4));
return true;
}
}