Initial commit: Sencho V1 complete with Auth and Dockerization

This commit is contained in:
unknown
2026-02-20 18:39:32 -05:00
commit 293f9cef26
51 changed files with 11547 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
const API_BASE = '/api';
export async function apiFetch(
endpoint: string,
options: RequestInit = {}
): Promise<Response> {
const url = `${API_BASE}${endpoint}`;
const defaultOptions: RequestInit = {
credentials: 'include',
headers: {
'Content-Type': 'application/json',
...options.headers,
},
};
const response = await fetch(url, { ...defaultOptions, ...options });
if (response.status === 401) {
// Clear auth state and redirect to login
window.location.href = '/';
throw new Error('Unauthorized');
}
return response;
}
export { API_BASE };