Remove every guest remnant: profile badge, register flow, delete-by-word
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,7 +34,7 @@ export function App() {
|
||||
/** پروفایل و پایهها را میگیرد و تصمیم میگیرد کاربر کجا برود. */
|
||||
const enter = useCallback(async () => {
|
||||
const [profile, grades] = await Promise.all([api.profile.get(), api.grades()]);
|
||||
await trackReferral(profile);
|
||||
await trackReferral();
|
||||
if (profile.name && profile.gradeId) setFlow({ kind: 'main', profile, grades });
|
||||
else setFlow({ kind: 'setup', profile, grades });
|
||||
}, []);
|
||||
@@ -124,7 +124,6 @@ export function App() {
|
||||
grades={flow.grades}
|
||||
payment={launchPayment}
|
||||
onSignedOut={() => setFlow({ kind: 'login' })}
|
||||
onRegistered={trackReferral}
|
||||
/>
|
||||
)}
|
||||
</motion.div>
|
||||
@@ -135,13 +134,10 @@ export function App() {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* اگر کاربر با لینکِ دعوت آمده بود و حالا با شماره وارد شده، معرفی را ثبت کن.
|
||||
* مهمان را سرور نمیپذیرد، پس کد تا ثبتِ شماره نگه داشته میشود.
|
||||
*/
|
||||
async function trackReferral(profile: UserProfile) {
|
||||
/** اگر کاربر با لینکِ دعوت آمده بود و حالا وارد شده، معرفی را ثبت کن. */
|
||||
async function trackReferral() {
|
||||
const code = store.get(KEYS.referralCode);
|
||||
if (!code || profile.isGuest) return;
|
||||
if (!code) return;
|
||||
try {
|
||||
await api.affiliate.track(code);
|
||||
store.remove(KEYS.referralCode);
|
||||
|
||||
Reference in New Issue
Block a user