Implement secure user authentication with role-based access control

Integrates user authentication using bcrypt, session management with PostgreSQL, and role-based access control for enhanced security and user management.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 91318273-c764-4fd4-be04-bdc12c38af32
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/0715008c-7244-40f4-befc-26c014852236/ab880d72-1a34-4d36-b5be-9f44df85ed1a.jpg
This commit is contained in:
michaelschal committed 2025-07-09 18:44:20 +00:00
1 parent 42b249e5b0
commit 5c01234fc4
16 files changed
+2384 -827

No files matched your search

+13 -5
View File
@@ -8,14 +8,22 @@ async function throwIfResNotOk(res: Response) {
}
export async function apiRequest(
method: string,
url: string,
data?: unknown | undefined,
options: {
method?: string;
headers?: Record<string, string>;
body?: string;
} = {}
): Promise<Response> {
const { method = 'GET', headers = {}, body } = options;
const res = await fetch(url, {
method,
headers: data ? { "Content-Type": "application/json" } : {},
body: data ? JSON.stringify(data) : undefined,
headers: {
'Content-Type': 'application/json',
...headers,
},
body,
credentials: "include",
});
@@ -44,7 +52,7 @@ export const getQueryFn: <T>(options: {
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
queryFn: getQueryFn({ on401: "throw" }),
queryFn: getQueryFn({ on401: "returnNull" }),
refetchInterval: false,
refetchOnWindowFocus: false,
staleTime: Infinity,