feat(App): update Finlytic Flutter app UI and blocs
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import 'package:finlytic_app/core/network/api_client.dart';
|
||||
import 'package:finlytic_app/features/calendar/models/corporate_event_model.dart';
|
||||
|
||||
class CalendarRepository {
|
||||
final ApiClient apiClient;
|
||||
|
||||
CalendarRepository({required this.apiClient});
|
||||
|
||||
Future<List<CorporateEventModel>> fetchEvents() async {
|
||||
try {
|
||||
final res = await apiClient.get('/api/v1/calendar');
|
||||
if (res.statusCode == 200 && res.data != null) {
|
||||
final List<dynamic> data = res.data;
|
||||
return data.map((json) => CorporateEventModel.fromJson(json)).toList();
|
||||
}
|
||||
return [];
|
||||
} catch (e) {
|
||||
print('Error fetching calendar events: $e');
|
||||
throw Exception('Kalender-Termine konnten nicht geladen werden');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user