Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

fix(web): redirect on 401 from mutations, preserve gitea body

justina476878aaabb
diff --git a/apps/web/src/fetchers/gitea-integration/verify-gitea-access.ts b/apps/web/src/fetchers/gitea-integration/verify-gitea-access.ts
index ece5aa5f0..5ef551734 100644
--- a/apps/web/src/fetchers/gitea-integration/verify-gitea-access.ts
+++ b/apps/web/src/fetchers/gitea-integration/verify-gitea-access.ts
@@ -20,8 +20,11 @@ async function verifyGiteaAccess(
if (!response.ok) {
const error = await response
+ .clone()
.json()
- .catch(() => ({ message: "Request failed" }));
+ .catch(async () => ({
+ message: (await response.text()) || "Request failed",
+ }));
throw new HttpError(
response.status,
typeof error === "object" && error && "message" in error
diff --git a/apps/web/src/query-client/index.ts b/apps/web/src/query-client/index.ts
index 7e42725f1..387fcd979 100644
--- a/apps/web/src/query-client/index.ts
+++ b/apps/web/src/query-client/index.ts
@@ -64,7 +64,13 @@ const queryClient = new QueryClient({
},
}),
mutationCache: new MutationCache({
- onError: (error) => captureCacheError(error, "mutation"),
+ onError: (error) => {
+ if (isUnauthorizedError(error)) {
+ handleUnauthorized();
+ return;
+ }
+ captureCacheError(error, "mutation");
+ },
}),
defaultOptions: {
queries: {