get country api
This commit is contained in:
@@ -6,37 +6,37 @@ class NetworkApiService {
|
||||
final Dio _dio = Dio();
|
||||
|
||||
// Common function for GET requests
|
||||
Future<Response> get(String endpoint,
|
||||
Future<Response> get(String url,
|
||||
{Map<String, dynamic>? queryParameters}) async {
|
||||
try {
|
||||
return await _dio.get(endpoint, queryParameters: queryParameters);
|
||||
return await _dio.get(url);
|
||||
} catch (e) {
|
||||
throw _handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
// Common function for POST requests
|
||||
Future<Response> post(String endpoint, dynamic data) async {
|
||||
Future<Response> post(String url, dynamic data) async {
|
||||
try {
|
||||
return await _dio.post(endpoint, data: data);
|
||||
return await _dio.post(url, data: data);
|
||||
} catch (e) {
|
||||
throw _handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
// Common function for PUT requests
|
||||
Future<Response> put(String endpoint, dynamic data) async {
|
||||
Future<Response> put(String url, dynamic data) async {
|
||||
try {
|
||||
return await _dio.put(endpoint, data: data);
|
||||
return await _dio.put(url, data: data);
|
||||
} catch (e) {
|
||||
throw _handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
// Common function for DELETE requests
|
||||
Future<Response> delete(String endpoint) async {
|
||||
Future<Response> delete(String url) async {
|
||||
try {
|
||||
return await _dio.delete(endpoint);
|
||||
return await _dio.delete(url);
|
||||
} catch (e) {
|
||||
throw _handleError(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user