Files
calchat/apps/client/src/services/ApiClient.ts
Linus Waldowsky 9cc6d17607 implement frontend skeleton with tab navigation and service layer
- Add tab-based navigation (Chat, Calendar) using Expo-Router
- Create auth screens (login, register) as skeletons
- Add dynamic routes for event detail and note editing
- Implement service layer (ApiClient, AuthService, EventService, ChatService)
- Add Zustand stores (AuthStore, EventsStore) for state management
- Create EventCard and EventConfirmDialog components
- Update CLAUDE.md with new frontend architecture documentation
- Add Zustand and FlashList to technology stack
2026-01-03 10:47:12 +01:00

52 lines
1.1 KiB
TypeScript

const API_BASE_URL =
process.env.EXPO_PUBLIC_API_URL || "http://localhost:3000/api";
type HttpMethod = "GET" | "POST" | "PUT" | "DELETE";
interface RequestOptions {
headers?: Record<string, string>;
body?: unknown;
}
async function request<T>(
_method: HttpMethod,
_endpoint: string,
_options?: RequestOptions,
): Promise<T> {
throw new Error("Not implemented");
}
export const ApiClient = {
get: async <T>(
endpoint: string,
options?: Omit<RequestOptions, "body">,
): Promise<T> => {
return request<T>("GET", endpoint, options);
},
post: async <T>(
endpoint: string,
body?: unknown,
options?: RequestOptions,
): Promise<T> => {
return request<T>("POST", endpoint, { ...options, body });
},
put: async <T>(
endpoint: string,
body?: unknown,
options?: RequestOptions,
): Promise<T> => {
return request<T>("PUT", endpoint, { ...options, body });
},
delete: async <T>(
endpoint: string,
options?: Omit<RequestOptions, "body">,
): Promise<T> => {
return request<T>("DELETE", endpoint, options);
},
};
export { API_BASE_URL };