mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43: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:
@@ -45,7 +45,7 @@ interface AuthState {
|
||||
state: string,
|
||||
deviceId?: string | null,
|
||||
) => Promise<void>;
|
||||
loginWithDeepLink: (token: string) => Promise<void>;
|
||||
loginWithDeepLink: (token: string, campaignSlug?: string | null) => Promise<void>;
|
||||
registerWithEmail: (
|
||||
email: string,
|
||||
password: string,
|
||||
@@ -322,8 +322,8 @@ export const useAuthStore = create<AuthState>()(
|
||||
await get().checkAdminStatus();
|
||||
},
|
||||
|
||||
loginWithDeepLink: async (token) => {
|
||||
const response = await authApi.pollDeepLinkToken(token);
|
||||
loginWithDeepLink: async (token, campaignSlug) => {
|
||||
const response = await authApi.pollDeepLinkToken(token, campaignSlug);
|
||||
if (!response.access_token || !response.refresh_token) {
|
||||
throw new Error('Invalid auth response: missing tokens');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user