[NOT FULLY WORKING] Added frontend react native interface.
This commit is contained in:
19
interfaces/nativeapp/src/api/calendar.ts
Normal file
19
interfaces/nativeapp/src/api/calendar.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import apiClient from './client';
|
||||
import { CalendarEvent } from '../types/calendar';
|
||||
|
||||
export const getCalendarEvents = async (start?: Date, end?: Date): Promise<CalendarEvent[]> => {
|
||||
try {
|
||||
const params: Record<string, string> = {};
|
||||
if (start instanceof Date) {
|
||||
params.start = start.toISOString();
|
||||
}
|
||||
if (end instanceof Date) {
|
||||
params.end = end.toISOString();
|
||||
}
|
||||
const response = await apiClient.get('/calendar/events', { params });
|
||||
return response.data;
|
||||
} catch (error) {
|
||||
console.error("Error fetching calendar events", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user