This commit is contained in:
poojapandeyx
2024-07-11 19:36:40 +05:30
parent a24febc95d
commit acf7f8980f
18 changed files with 447 additions and 36 deletions

View File

@@ -1,6 +1,10 @@
class ApiEndpoints {
static const base="https://tanami.betadelivery.com/";
static const baseurl =
"https://tanami.betadelivery.com/api/development/v1/"; //App Base url
static const getcountryurl = baseurl + "country/getAllCountry";
static const requestotpapi=baseurl +"auth/public/register";
static const requestresendotp=baseurl+"auth/public/resend-otp";
static const verifyotp=baseurl+"auth/public/verify-otp";
}

View File

@@ -37,11 +37,30 @@ class NetworkApiService {
}
// Common function for POST requests
Future<Response> post(String url, dynamic data) async {
Future<ResponseData> post(String url, dynamic data) async {
if (kDebugMode) {
print("data >>> $data");
print("api url is >>> $url");
}
try {
return await _dio.post(url, data: data);
var response= await _dio.post(url, data: data);
if (response.statusCode == 201 || response.statusCode == 200) {
return ResponseData<dynamic>("success", ResponseStatus.SUCCESS,
data: response.data);
}else {
try {
return ResponseData<dynamic>(
response.data['message'].toString(), ResponseStatus.FAILED);
} catch (_) {
return ResponseData<dynamic>(
data: response.data,
response.statusMessage!,
ResponseStatus.FAILED);
}}
} catch (e) {
throw _handleError(e);
return ResponseData<dynamic>(
"Oops something went wrong",
ResponseStatus.FAILED);
}
}