authenticatedPost method
Make authenticated HTTP POST request
Implementation
Future<Map<String, dynamic>> authenticatedPost(String endpoint, {
Map<String, dynamic>? body,
String? jsonBody,
}) async {
await _ensureInitialized();
try {
final requestBody = jsonBody ?? (body != null ? jsonEncode(body) : null);
final response = await http.post(
Uri.parse('$_apiBaseUrl/$endpoint'),
headers: getAuthHeaders(),
body: requestBody,
);
return _handleResponse(response);
} catch (e) {
OnairosDebugHelper.log('❌ Error in authenticated POST: $e');
rethrow;
}
}