feat: send campaign_slug during standalone email registration

Frontend now reads campaign slug from localStorage and includes it
in the registration API call, ensuring campaign attribution works
even if email verification happens in a different browser.
This commit is contained in:
c0mrade
2026-04-13 14:43:39 +03:00
parent 3d0fc76ecd
commit a46c89e45e
2 changed files with 3 additions and 0 deletions

View File

@@ -97,6 +97,7 @@ export const authApi = {
first_name?: string;
language?: string;
referral_code?: string;
campaign_slug?: string;
}): Promise<RegisterResponse> => {
const response = await apiClient.post<RegisterResponse>(
'/cabinet/auth/email/register/standalone',

View File

@@ -359,12 +359,14 @@ export const useAuthStore = create<AuthState>()(
registerWithEmail: async (email, password, firstName, referralCode) => {
const code = referralCode || getPendingReferralCode() || undefined;
const campaignSlug = getPendingCampaignSlug() || undefined;
const response = await authApi.registerEmailStandalone({
email,
password,
first_name: firstName,
language: navigator.language.split('-')[0] || 'ru',
referral_code: code,
campaign_slug: campaignSlug,
});
consumeReferralCode();
return response;