refactor: review round 2 — remove dead code, fix type safety, improve UX

- Remove LinkOAuthCallback.tsx (dead code) and its route from App.tsx
- Move LINK_OAUTH_* constants to OAuthCallback.tsx
- Replace local ServerLinkResult with LinkCallbackResponse from types
- Move merge navigate() from render body to useEffect
- Track errorMode to show correct CTA (Return to Telegram vs Back to Login)
- Remove non-null assertions with proper narrowing
- Extract getErrorDetail helper for error casting
- Add smart polling success detection (stop + toast when linked count increases)
This commit is contained in:
Fringg
2026-03-05 03:10:22 +03:00
parent da1926f0e1
commit 0d99ea0069
4 changed files with 74 additions and 149 deletions

View File

@@ -40,7 +40,6 @@ const ConnectionQR = lazy(() => import('./pages/ConnectionQR'));
const TopUpMethodSelect = lazy(() => import('./pages/TopUpMethodSelect'));
const TopUpAmount = lazy(() => import('./pages/TopUpAmount'));
const ConnectedAccounts = lazy(() => import('./pages/ConnectedAccounts'));
const LinkOAuthCallback = lazy(() => import('./pages/LinkOAuthCallback'));
const LinkTelegramCallback = lazy(() => import('./pages/LinkTelegramCallback'));
const MergeAccounts = lazy(() => import('./pages/MergeAccounts'));
@@ -317,16 +316,6 @@ function App() {
</ProtectedRoute>
}
/>
<Route
path="/auth/link/callback"
element={
<ProtectedRoute>
<LazyPage>
<LinkOAuthCallback />
</LazyPage>
</ProtectedRoute>
}
/>
<Route
path="/auth/link/telegram/callback"
element={