Revert "sadasd"

This reverts commit 9f85ce4f52.
This commit is contained in:
alorig
2025-12-09 00:26:01 +05:00
parent 9f85ce4f52
commit 92d16c76a7
11 changed files with 198 additions and 774 deletions

View File

@@ -85,11 +85,9 @@ export default function SignUpForm({ planDetails: planDetailsProp, planLoading:
}
try {
console.log('[SignUp] Starting registration...');
// Generate username from email if not provided
const username = formData.username || formData.email.split("@")[0];
console.log('[SignUp] Calling register API...');
const user = await register({
email: formData.email,
password: formData.password,
@@ -100,29 +98,13 @@ export default function SignUpForm({ planDetails: planDetailsProp, planLoading:
plan_slug: planSlug || undefined,
});
console.log('[SignUp] Registration successful, user:', user);
console.log('[SignUp] Auth state before delay:', useAuthStore.getState());
// CRITICAL: Wait for auth state to persist to localStorage before navigating
// Increased to 500ms to ensure Zustand persist middleware completes
await new Promise(resolve => setTimeout(resolve, 500));
// Verify auth state is persisted
const persistedState = localStorage.getItem('auth-storage');
console.log('[SignUp] Persisted auth state:', persistedState);
console.log('[SignUp] Auth state after delay:', useAuthStore.getState());
const status = user?.account?.status;
console.log('[SignUp] Account status:', status);
if (status === "pending_payment") {
console.log('[SignUp] Navigating to /account/plans');
navigate("/account/plans", { replace: true });
} else {
console.log('[SignUp] Navigating to /sites');
navigate("/sites", { replace: true });
}
} catch (err: any) {
console.error('[SignUp] Registration error:', err);
setError(err.message || "Registration failed. Please try again.");
}
};