diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8d6bb3dc4..ba2c41ea2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1729,8 +1729,8 @@ packages: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} - aproba@2.0.0: - resolution: {integrity: sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==} + aproba@2.1.0: + resolution: {integrity: sha512-tLIEcj5GuR2RSTnxNKdkK0dJ/GrC7P38sUkiDmDuHfsHmbagTFAxDVIBltoklXEVIQ/f14IL8IMJ5pn9Hez1Ew==} are-we-there-yet@2.0.0: resolution: {integrity: sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw==} @@ -2071,8 +2071,8 @@ packages: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} - detect-libc@2.0.3: - resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==} + detect-libc@2.1.2: + resolution: {integrity: sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==} engines: {node: '>=8'} detect-node-es@1.1.0: @@ -4669,7 +4669,7 @@ snapshots: '@mapbox/node-pre-gyp@1.0.11': dependencies: - detect-libc: 2.0.3 + detect-libc: 2.1.2 https-proxy-agent: 5.0.1 make-dir: 3.1.0 node-fetch: 2.7.0 @@ -5931,7 +5931,7 @@ snapshots: normalize-path: 3.0.0 picomatch: 2.3.1 - aproba@2.0.0: {} + aproba@2.1.0: {} are-we-there-yet@2.0.0: dependencies: @@ -6252,7 +6252,7 @@ snapshots: dequal@2.0.3: {} - detect-libc@2.0.3: {} + detect-libc@2.1.2: {} detect-node-es@1.1.0: {} @@ -6557,7 +6557,7 @@ snapshots: gauge@3.0.2: dependencies: - aproba: 2.0.0 + aproba: 2.1.0 color-support: 1.1.3 console-control-strings: 1.1.0 has-unicode: 2.0.1 diff --git a/src/lib/auth.ts b/src/lib/auth.ts index 9f52f422a..64041ef69 100644 --- a/src/lib/auth.ts +++ b/src/lib/auth.ts @@ -102,7 +102,20 @@ async function validateUser( } const data = await response.json(); - return data as any; // Or process data as needed + + // Validate response structure + if (!data?.data?.userid || !data?.data?.name) { + console.error('Invalid API response:', data); + return { data: null }; + } + + return { + data: { + name: data.data.name, + userid: data.data.userid, + token: data.data.token || '', + } + }; } catch (error) { console.error('Error validating user:', error); }