From 80c2cce4de41fba94dc68e3e9458d45b982134da Mon Sep 17 00:00:00 2001 From: Owen Date: Wed, 10 Jun 2026 12:11:57 +0200 Subject: [PATCH] change response on access token delete function --- TODO | 4 ++-- src/server/lichess.ts | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index dbc39f1..e22f089 100644 --- a/TODO +++ b/TODO @@ -10,5 +10,5 @@ add throw errors or return errors in server code try/catch where needed in client code -on logout reset selectedStudyid -make login lichess button as wide as logout - full width? \ No newline at end of file + +generate state and check it against the state returned from lichess https://lichess.org/api#tag/oauth/GET/oauth \ No newline at end of file diff --git a/src/server/lichess.ts b/src/server/lichess.ts index 80b0b01..1532c8c 100644 --- a/src/server/lichess.ts +++ b/src/server/lichess.ts @@ -117,8 +117,14 @@ const deleteAccessToken = createServerFn().handler(async () => { }, }); - return await response.json(); + if (!response.ok) { + throw new Error(`Failed to delete access token: ${response.statusText}`); + } + + return { success: true }; } + + return { success: false, message: "No token found to delete." }; }); export const logout = createServerFn().handler(async () => {