feat: account merge flow — merge redirect, error handling, server-complete linking

- Добавлен merge_required + merge_token redirect в OAuthCallback и LinkTelegramCallback
- Server-complete OAuth linking для Mini App (внешний браузер)
- getErrorDetail: единый экстрактор ошибок из axios response
- LinkTelegramCallback: типизированный catch с getErrorDetail
- Удалён мёртвый экспорт getAndClearOAuthState
- CSRF валидация для Telegram и OAuth linking flows
- Типы ServerCompleteResponse, LinkCallbackResponse
This commit is contained in:
Fringg
2026-03-05 05:25:50 +03:00
parent 0d99ea0069
commit 2fc0759f89
10 changed files with 120 additions and 78 deletions

View File

@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';
import { authApi } from '../api/auth';
import { useToast } from '../components/Toast';
import { LINK_TELEGRAM_STATE_KEY } from './ConnectedAccounts';
import { getErrorDetail } from './OAuthCallback';
export default function LinkTelegramCallback() {
const { t } = useTranslation();
@@ -69,8 +70,11 @@ export default function LinkTelegramCallback() {
showToast({ type: 'success', message: t('profile.accounts.linkSuccess') });
navigate('/profile/accounts', { replace: true });
}
} catch {
showToast({ type: 'error', message: t('profile.accounts.linkError') });
} catch (err: unknown) {
showToast({
type: 'error',
message: getErrorDetail(err) || t('profile.accounts.linkError'),
});
navigate('/profile/accounts', { replace: true });
}
};