refactor: remove console logs for token refresh and user profile requests in SubmitData and AppointmentPage components

This commit is contained in:
hamed
2025-11-18 15:39:45 +03:30
parent 5c98b4de3e
commit 2894da3c69
2 changed files with 1 additions and 13 deletions
+1 -8
View File
@@ -13,7 +13,6 @@ function SubmitData({ setStep, data, prevData, setErrors }) {
try {
const refreshToken = Cookies.get("refresh_token");
if (!refreshToken) {
console.log("⚠️ refresh_token موجود نیست");
return;
}
@@ -23,7 +22,6 @@ function SubmitData({ setStep, data, prevData, setErrors }) {
formData.append("client_secret", process.env.NEXT_PUBLIC_CLIENT_SECRET || "13yfCHptFjsIoEzwA996bjGuSEFy02Dkc");
formData.append("refresh_token", refreshToken);
console.log("🔄 در حال refresh کردن access token...");
const response = await request.postRefreshToken(formData);
if (response?.access_token) {
@@ -31,10 +29,9 @@ function SubmitData({ setStep, data, prevData, setErrors }) {
if (response.refresh_token) {
Cookies.set("refresh_token", response.refresh_token, { expires: 7 });
}
console.log("✅ access token با موفقیت refresh شد");
}
} catch (error) {
console.log("❌ خطا در refresh token:", error);
// خطا در refresh token
}
};
@@ -90,14 +87,11 @@ function SubmitData({ setStep, data, prevData, setErrors }) {
try {
if (uuid) {
// اگر uuid داریم، پروفایل وجود داره و باید PATCH کنیم
console.log('📤 ارسال درخواست PATCH - UUID:', uuid, 'Payload:', payload);
await request.patchUserProfile(payload, uuid);
} else {
// اگر uuid نداریم، پروفایل وجود نداره و باید POST کنیم
console.log('📤 ارسال درخواست POST - Payload:', payload);
await request.postUserProfile(payload);
}
console.log('✅ پروفایل با موفقیت ذخیره شد');
// فوراً بعد از موفقیت، refresh token می‌زنیم
await refreshAccessToken();
@@ -105,7 +99,6 @@ function SubmitData({ setStep, data, prevData, setErrors }) {
setLoading(false);
newStep();
} catch (error) {
console.log('❌ خطا در ذخیره پروفایل:', error?.response?.data || error);
setLoading(false);
// اگر خطای validation بود، error ها را ست می‌کنیم
if (error?.response?.data) {
-5
View File
@@ -52,13 +52,9 @@ function AppointmentPage({ doctor, disabledDates, matchedCity }) {
// سپس اگر uuid داریم، بقیه اطلاعات را از API می‌گیریم
if (userInfo && parsedData) {
try {
console.log('📤 درخواست دریافت پروفایل کاربر - UUID:', parsedData.uuid);
const res = await request.getUserProfile(parsedData.uuid);
console.log('📥 پاسخ دریافتی از API:', res);
if (res) {
console.log('🏥 basic_insurance از API:', res.basic_insurance);
console.log('🏥 supplementary_insurance از API:', res.supplementary_insurance);
const newData = {
uuid: res.uuid,
phone: { value: usernameFromCookie, isEdit: false },
@@ -120,7 +116,6 @@ function AppointmentPage({ doctor, disabledDates, matchedCity }) {
if (userInfo && parsedData && !data.uuid) {
try {
console.log('📤 درخواست مجدد دریافت پروفایل (step 3) - UUID:', parsedData.uuid);
const res = await request.getUserProfile(parsedData.uuid);
if (res) {