chore: codify React component style

This commit is contained in:
2026-08-25 15:33:20 +03:00
parent 268acdf2e1
commit d10e1dd182
65 changed files with 711 additions and 365 deletions
+13 -5
View File
@@ -21,16 +21,16 @@ function setAuthenticatedSession(next: boolean) {
for (const listener of authSessionListeners) listener();
}
export function configureAuthClient(handlers: AuthHandlers | null) {
function configureAuthClient(handlers: AuthHandlers | null) {
auth = handlers;
setAuthenticatedSession(Boolean(auth?.accessToken()));
}
export function getAuthenticatedSessionSnapshot() {
function getAuthenticatedSessionSnapshot() {
return hasAuthenticatedSession;
}
export function subscribeAuthenticatedSession(listener: () => void) {
function subscribeAuthenticatedSession(listener: () => void) {
authSessionListeners.add(listener);
return () => authSessionListeners.delete(listener);
}
@@ -71,10 +71,18 @@ async function authenticatedFetch(request: Request): Promise<Response> {
: response;
}
export const apiClient = createClient<paths>({
const apiClient = createClient<paths>({
baseUrl: apiBaseUrl,
credentials: "include",
fetch: authenticatedFetch,
});
export const apiQueryClient = createQueryClient(apiClient);
const apiQueryClient = createQueryClient(apiClient);
export {
apiClient,
apiQueryClient,
configureAuthClient,
getAuthenticatedSessionSnapshot,
subscribeAuthenticatedSession,
};