From dac8bfafdae5e0b82b3e47030101c4e9022f7ae8 Mon Sep 17 00:00:00 2001 From: "Dennis (via Claude+Gemma)" Date: Sat, 23 May 2026 05:00:29 +0200 Subject: [PATCH] feat(api-client-final): API-Client mit allen Phase-3 Endpoints + Logout-fix [tsc:fail] --- .phase3-state.json | 7 +++++-- GENERATION_LOG.md | 17 +++++++++++++++++ apps/web/src/lib/api.ts | 33 +++++++++++++++++++++++++++++++-- 3 files changed, 53 insertions(+), 4 deletions(-) diff --git a/.phase3-state.json b/.phase3-state.json index 9ec1ffb..6fc4d5d 100644 --- a/.phase3-state.json +++ b/.phase3-state.json @@ -5,6 +5,9 @@ "empty-loading-states", "time-entries-search-filter" ], - "current_feature": "user-profile-page", - "started_at": "2026-05-23T04:57:10.921624" + "current_feature": "api-client-final", + "started_at": "2026-05-23T04:57:10.921624", + "attempted_features": [ + "user-profile-page" + ] } \ No newline at end of file diff --git a/GENERATION_LOG.md b/GENERATION_LOG.md index e184827..a64186e 100644 --- a/GENERATION_LOG.md +++ b/GENERATION_LOG.md @@ -413,3 +413,20 @@ src/routes/users.ts(41,34): error TS2339: Property 'id' does not exist on type ' undefined /home/dark/Developer/EmberClone/apps/api:  ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with exit code 2: tsc --noEmit -p tsconfig.json +- `04:59:58` **INFO** Committed feature user-profile-page +- `04:59:59` **INFO** Pushed: rc=0 + +## Phase-3 Feature: api-client-final (2026-05-23 04:59:59) + +- `04:59:59` **INFO** Description: API-Client mit allen Phase-3 Endpoints + Logout-fix +- `04:59:59` **INFO** Generating apps/web/src/lib/api.ts (FINALE Version der api.ts. Behalte ALLE bestehenden Funktionen (login,…) +- `05:00:27` **INFO** wrote 3285 chars in 28.9s (attempt 1) +- `05:00:27` **INFO** Running tsc --noEmit on api… +- `05:00:29` **WARN** tsc errors: +src/routes/users.ts(21,34): error TS2339: Property 'id' does not exist on type 'string | object | Buffer'. + Property 'id' does not exist on type 'string'. +src/routes/users.ts(41,34): error TS2339: Property 'id' does not exist on type 'string | object | Buffer'. + Property 'id' does not exist on type 'string'. +undefined +/home/dark/Developer/EmberClone/apps/api: + ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL  Command failed with exit code 2: tsc --noEmit -p tsconfig.json diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts index 3b63902..a7422df 100644 --- a/apps/web/src/lib/api.ts +++ b/apps/web/src/lib/api.ts @@ -40,7 +40,7 @@ export const api = { return data }, - logout() { + async logout() { localStorage.removeItem("auth_token") return request("/auth/logout", { method: "POST" }).catch(() => {}) }, @@ -49,6 +49,13 @@ export const api = { return request<{ id: string; email: string; name: string; role: "admin" | "user" }>("/auth/me") }, + async updateProfile(data: { name: string }) { + return request("/users/me", { + method: "PATCH", + body: JSON.stringify(data) + }) + }, + async listTimeEntries(opts?: Record) { const query = opts ? `?${new URLSearchParams(opts).toString()}` : "" return request(`/time-entries${query}`) @@ -67,8 +74,30 @@ export const api = { }) }, + async getRunningTimeEntry() { + try { + return await request("/time-entries/running") + } catch (err: any) { + if (err.status === 404) return null + throw err + } + }, + + async startTimeEntry(data: { description: string; projectId?: string }) { + return request("/time-entries/start", { + method: "POST", + body: JSON.stringify(data) + }) + }, + + async stopTimeEntry(id: string) { + return request(`/time-entries/${id}/stop`, { + method: "POST" + }) + }, + async listCustomers() { - return request( "/customers") + return request("/customers") }, async createCustomer(data: Partial) {