mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-29 18:13:47 +00:00
fix: referral system — stop cabinet redirect to Telegram, fix deep link code handling
- Remove redirect to Telegram bot when email auth disabled + referral code present (cabinet links should stay on cabinet, bot links should go to bot) - Remove referral_code from deep link auth (existing users can't get referrals) - Don't consume referralCode in deep link path — leave it in localStorage for OIDC/widget auth methods that actually send it to the backend - Consume campaign slug once into ref to survive retries (codesConsumedRef pattern) - Update loginWithDeepLink to only accept (token, campaignSlug) — no referralCode - Update pollDeepLinkToken API to match backend schema change
This commit is contained in:
@@ -290,7 +290,7 @@ export const authApi = {
|
||||
return response.data;
|
||||
},
|
||||
|
||||
pollDeepLinkToken: async (token: string): Promise<AuthResponse> => {
|
||||
pollDeepLinkToken: async (token: string, campaignSlug?: string | null): Promise<AuthResponse> => {
|
||||
// validateStatus: only treat 200 as success.
|
||||
// Server returns 202 for "pending" and 410 for "expired" —
|
||||
// these must reject so the polling catch-block can handle them.
|
||||
@@ -299,7 +299,7 @@ export const authApi = {
|
||||
// which triggers checkAdminStatus() → 401 → safeRedirectToLogin() → infinite reload.
|
||||
const response = await apiClient.post<AuthResponse>(
|
||||
'/cabinet/auth/deeplink/poll',
|
||||
{ token },
|
||||
{ token, campaign_slug: campaignSlug || undefined },
|
||||
{ validateStatus: (status) => status === 200 },
|
||||
);
|
||||
return response.data;
|
||||
|
||||
Reference in New Issue
Block a user