From 6c77b10e3341ed41eb0dcd56184a159a475893d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=BC=E3=83=BC=E3=83=AC?= Date: Wed, 7 May 2025 17:56:50 +0500 Subject: [PATCH] Update profile.js --- api/v1/src/profile.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/api/v1/src/profile.js b/api/v1/src/profile.js index 381467b..ea72df4 100644 --- a/api/v1/src/profile.js +++ b/api/v1/src/profile.js @@ -8,7 +8,10 @@ async function getProfileFromAnixart(profileId, token = '') { const response = await axios.get(url); const profileData = response.data; - let isVerified = false; + // Убедимся, что profile существует + if (!profileData.profile) { + profileData.profile = {}; + } // Проверка верификации try { @@ -16,11 +19,13 @@ async function getProfileFromAnixart(profileId, token = '') { const verifiedList = verifiedResponse.data; if (Array.isArray(verifiedList) && verifiedList.includes(profileId.toString())) { - isVerified = true; profileData.profile.is_verified = true; + } else { + profileData.profile.is_verified = false; } } catch { // Ошибку верификации игнорируем + profileData.profile.is_verified = false; } // Подгружаем кастомные роли @@ -36,14 +41,7 @@ async function getProfileFromAnixart(profileId, token = '') { // Ошибку загрузки ролей игнорируем } - // // Тестовое поле privilege_level (можно отключить) - // profileData.profile.privilege_level = 0; - // profileData.profile.status = "Я Falkor!"; - - return { - ...profileData, - is_verified: isVerified, - }; + return profileData; } catch { return { code: 2,