Fix settings save TypeScript error for OAuth profiles.

Use a typed local array before assigning into Record body so Next build succeeds.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
eric 2026-08-11 19:22:16 -05:00
parent 0d2f63757a
commit 1f5aef2065

View File

@ -111,14 +111,15 @@ export default function SettingsPage() {
settings.shorts_oauth_redirect_uri || "https://dylive.nomadro.com/api/shorts/oauth/callback"
);
const profiles = Array.isArray(settings.shorts_oauth_profiles) ? settings.shorts_oauth_profiles : [];
body.shorts_oauth_profiles = profiles.map((p: any) => ({
const oauthProfiles = profiles.map((p: any) => ({
id: String(p.id || "").toUpperCase(),
label: String(p.label || ""),
client_id: String(p.client_id || ""),
client_secret: String(p.client_secret || ""),
}));
body.shorts_oauth_profiles = oauthProfiles;
// Keep legacy global client in sync with profile A when A is filled
const profA = body.shorts_oauth_profiles.find((p: any) => p.id === "A");
const profA = oauthProfiles.find((p) => p.id === "A");
if (profA?.client_id) body.shorts_oauth_client_id = profA.client_id;
if (profA?.client_secret && !String(profA.client_secret).startsWith("***")) {
body.shorts_oauth_client_secret = profA.client_secret;