Files
omsorg/omsorgapp/electron/backend/httpClient.cjs
T
Felix KemmlerandClaude Sonnet 5 b6c1389c55 Reorganize into monorepo layout, move mitarbeiter-app to legacy reference
Consolidates the previously separate omsorgapp and omsorgCore repos
(each had their own nested .git with GitHub history) plus the old
root-level website/mitarbeiter-app into a single monorepo, matching
the structure already documented in the root CLAUDE.md. Also moves
the PHP employee app aside as omsorgWeb/mitarbeiter-app-legacy/ to
serve as a template for a ground-up rewrite.

Fixes .gitignore in the same pass: the config-secrets/uploads/data
patterns were unanchored (relative to repo root, not depth-agnostic),
so they silently stopped matching once the app moved under omsorgWeb/.
Patterns are now **/-prefixed and cover both mitarbeiter-app and
mitarbeiter-app-legacy, keeping DB/SMTP credentials and uploaded
employee documents out of version control.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-07 14:21:37 +02:00

35 lines
963 B
JavaScript

const { API_BASE } = require('./config.cjs');
// Einzige Stelle, die fetch/API_BASE/Authorization-Header kennt. Kennt keine konkreten
// Endpunkte - die kommen aus den <kategorie>Client.cjs-Dateien (z.B. authClient.cjs).
async function request(method, path, { body, accessToken } = {}) {
const headers = { 'Content-Type': 'application/json' };
if (accessToken) headers.Authorization = `Bearer ${accessToken}`;
let response;
try {
response = await fetch(`${API_BASE}${path}`, {
method,
headers,
body: body !== undefined ? JSON.stringify(body) : undefined
});
} catch (err) {
return { ok: false, status: 0, data: null, error: err.message };
}
if (response.status === 204) {
return { ok: true, status: 204, data: null };
}
let data = null;
try {
data = await response.json();
} catch {
data = null;
}
return { ok: response.ok, status: response.status, data };
}
module.exports = { request };