mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-19 00:12:18 +00:00
refactor(v1.4.15): apply simplify-review safe suggestions
Drop dead exports + misleading comments + unreachable defaults flagged by phase-D simplify review (autonomous-yes items only): - channel-state: drop unused TEST_CONSTANTS re-export - retry-policy: drop unused RejectKind type alias - achievements: drop misleading "fallback" comment on exhaustive switch - notification-status-card: drop unreachable default in stateBadgeFor - withings: export isWithingsRefreshReauthFailure + dedupe inline classifier in /api/withings/status route - codex-slug-cache: drop test-only inspectCodexSlugCache helper; tests read getCachedCodexSlug() instead Findings 1, 2, 8, 9 deferred to v1.4.16 (require product call). Finding 11 is an explicit anti-finding. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
895c9f3b3a
commit
cd3b890067
9 files changed
+11
-51
No files matched your search
@@ -5,6 +5,7 @@ import { apiSuccess } from "@/lib/api-response";
|
||||
import { decrypt, encrypt } from "@/lib/crypto";
|
||||
import { getUserWithingsCredentials } from "@/lib/withings/credentials";
|
||||
import { refreshAccessToken } from "@/lib/withings/client";
|
||||
import { isWithingsRefreshReauthFailure } from "@/lib/withings/sync";
|
||||
import { markReauthRequired } from "@/lib/integrations/status";
|
||||
|
||||
/**
|
||||
@@ -80,17 +81,7 @@ export const GET = apiHandler(async () => {
|
||||
// the user reconnects. We mirror the same status-code parsing
|
||||
// the sync path does.
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
const statusMatch = /Withings\s+\w+\s+error:\s*(\d+)/.exec(message);
|
||||
const statusCode = statusMatch
|
||||
? Number.parseInt(statusMatch[1], 10)
|
||||
: NaN;
|
||||
const isReauth =
|
||||
Number.isFinite(statusCode) &&
|
||||
(statusCode === 100 ||
|
||||
statusCode === 101 ||
|
||||
statusCode === 102 ||
|
||||
(statusCode >= 200 && statusCode <= 299));
|
||||
if (isReauth) {
|
||||
if (isWithingsRefreshReauthFailure(message)) {
|
||||
await markReauthRequired(user.id, "withings", message).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user