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
This commit is contained in:
51
apps/client/src/services/ApiClient.ts
Normal file
51
apps/client/src/services/ApiClient.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
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 };
|
||||
Reference in New Issue
Block a user