Merge branch 'new-fixes'
This commit is contained in:
@@ -19,6 +19,7 @@ import {
|
|||||||
unlinkOAuthFx,
|
unlinkOAuthFx,
|
||||||
type AuthMethod,
|
type AuthMethod,
|
||||||
} from '@/shared/model/auth'
|
} from '@/shared/model/auth'
|
||||||
|
import { getErrorMessage } from '@/shared/lib/get-error-message'
|
||||||
|
|
||||||
const METHOD_LABELS: Record<string, string> = { password: 'Пароль', vk: 'ВКонтакте', yandex: 'Яндекс' }
|
const METHOD_LABELS: Record<string, string> = { password: 'Пароль', vk: 'ВКонтакте', yandex: 'Яндекс' }
|
||||||
|
|
||||||
@@ -95,7 +96,7 @@ export function AuthMethodsSection() {
|
|||||||
return url
|
return url
|
||||||
},
|
},
|
||||||
onSuccess: (url) => setVerificationUrl(url),
|
onSuccess: (url) => setVerificationUrl(url),
|
||||||
onError: (err) => setEmailChangeError(err?.message || 'Не удалось сменить email'),
|
onError: (err) => setEmailChangeError(getErrorMessage(err, 'Не удалось сменить email')),
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!user) return null
|
if (!user) return null
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
export function getErrorMessage(error: unknown, fallback = 'Произошла ошибка'): string {
|
export function getErrorMessage(error: unknown, fallback = 'Произошла ошибка'): string {
|
||||||
|
if (error && typeof error === 'object' && 'response' in error) {
|
||||||
|
const axiosErr = error as { response?: { data?: { error?: string } } }
|
||||||
|
if (axiosErr.response?.data?.error) return axiosErr.response.data.error
|
||||||
|
}
|
||||||
if (error instanceof Error && error.message) return error.message
|
if (error instanceof Error && error.message) return error.message
|
||||||
return fallback
|
return fallback
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
@@ -49,7 +49,8 @@ export async function registerUserPaymentRoutes(fastify) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const idempotencyKey = `${id}-${Date.now()}`
|
const idempotencyKey = `${id}-${Date.now()}`
|
||||||
const returnUrl = `${process.env.CLIENT_PUBLIC_URL || 'http://127.0.0.1:5173'}/me/orders/${id}?paid=1`
|
const clientUrl = (process.env.CLIENT_PUBLIC_URL || 'http://127.0.0.1:5173').replace(/\/$/, '')
|
||||||
|
const returnUrl = `${clientUrl}/me/orders/${id}?paid=1`
|
||||||
const clientIp = request.ip
|
const clientIp = request.ip
|
||||||
|
|
||||||
const amount = {
|
const amount = {
|
||||||
|
|||||||
Reference in New Issue
Block a user