Skip to content

πŸ“¨ The ultimate agentic social media scheduling tool πŸ€–

fix(auth): don't read the activate response body once the onboarding redirect started

Gilad Resisi85d663f1d30e
diff --git a/apps/frontend/src/components/auth/after.activate.tsx b/apps/frontend/src/components/auth/after.activate.tsx
index ef2dee1f1..70f36c44a 100644
--- a/apps/frontend/src/components/auth/after.activate.tsx
+++ b/apps/frontend/src/components/auth/after.activate.tsx
@@ -23,18 +23,20 @@ export const AfterActivate = () => {
}, []);
const loadCode = useCallback(async () => {
if (params.code) {
- const { can } = await (
- await fetch(`/auth/activate`, {
- method: 'POST',
- body: JSON.stringify({
- code: params.code,
- datafast_visitor_id,
- }),
- headers: {
- 'Content-Type': 'application/json',
- },
- })
- ).json();
+ const response = await fetch(`/auth/activate`, {
+ method: 'POST',
+ body: JSON.stringify({
+ code: params.code,
+ datafast_visitor_id,
+ }),
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ });
+ if (response.headers.get('onboarding')) {
+ return;
+ }
+ const { can } = await response.json();
if (!can) {
setShowLoader(false);
}