mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2025-10-02 03:46:42 +02:00
feat: add first login flag (#8161)
This commit is contained in:
@@ -38,9 +38,7 @@ export function EmailLoginForm(props: EmailLoginFormProps) {
|
|||||||
|
|
||||||
const currentLocation = window.location.href;
|
const currentLocation = window.location.href;
|
||||||
const url = new URL(currentLocation, window.location.origin);
|
const url = new URL(currentLocation, window.location.origin);
|
||||||
if (response?.isNewUser) {
|
url.searchParams.set(FIRST_LOGIN_PARAM, response?.isNewUser ? '1' : '0');
|
||||||
url.searchParams.set(FIRST_LOGIN_PARAM, '1');
|
|
||||||
}
|
|
||||||
window.location.href = url.toString();
|
window.location.href = url.toString();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -81,9 +81,10 @@ export function GitHubButton(props: GitHubButtonProps) {
|
|||||||
localStorage.removeItem(GITHUB_LAST_PAGE);
|
localStorage.removeItem(GITHUB_LAST_PAGE);
|
||||||
setAuthToken(response.token);
|
setAuthToken(response.token);
|
||||||
|
|
||||||
if (response?.isNewUser) {
|
redirectUrl.searchParams.set(
|
||||||
redirectUrl.searchParams.set(FIRST_LOGIN_PARAM, '1');
|
FIRST_LOGIN_PARAM,
|
||||||
}
|
response?.isNewUser ? '1' : '0',
|
||||||
|
);
|
||||||
|
|
||||||
const shouldTriggerPurchase =
|
const shouldTriggerPurchase =
|
||||||
localStorage.getItem(CHECKOUT_AFTER_LOGIN_KEY) !== '0';
|
localStorage.getItem(CHECKOUT_AFTER_LOGIN_KEY) !== '0';
|
||||||
|
@@ -81,9 +81,10 @@ export function GoogleButton(props: GoogleButtonProps) {
|
|||||||
redirectUrl = new URL(authRedirectUrl, window.location.origin);
|
redirectUrl = new URL(authRedirectUrl, window.location.origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response?.isNewUser) {
|
redirectUrl.searchParams.set(
|
||||||
redirectUrl.searchParams.set(FIRST_LOGIN_PARAM, '1');
|
FIRST_LOGIN_PARAM,
|
||||||
}
|
response?.isNewUser ? '1' : '0',
|
||||||
|
);
|
||||||
|
|
||||||
const shouldTriggerPurchase =
|
const shouldTriggerPurchase =
|
||||||
localStorage.getItem(CHECKOUT_AFTER_LOGIN_KEY) !== '0';
|
localStorage.getItem(CHECKOUT_AFTER_LOGIN_KEY) !== '0';
|
||||||
|
@@ -81,9 +81,10 @@ export function LinkedInButton(props: LinkedInButtonProps) {
|
|||||||
redirectUrl = new URL(authRedirectUrl, window.location.origin);
|
redirectUrl = new URL(authRedirectUrl, window.location.origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response?.isNewUser) {
|
redirectUrl.searchParams.set(
|
||||||
redirectUrl.searchParams.set(FIRST_LOGIN_PARAM, '1');
|
FIRST_LOGIN_PARAM,
|
||||||
}
|
response?.isNewUser ? '1' : '0',
|
||||||
|
);
|
||||||
|
|
||||||
const shouldTriggerPurchase =
|
const shouldTriggerPurchase =
|
||||||
localStorage.getItem(CHECKOUT_AFTER_LOGIN_KEY) !== '0';
|
localStorage.getItem(CHECKOUT_AFTER_LOGIN_KEY) !== '0';
|
||||||
|
@@ -1,7 +1,11 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import Cookies from 'js-cookie';
|
import Cookies from 'js-cookie';
|
||||||
import { httpPost } from '../../lib/http';
|
import { httpPost } from '../../lib/http';
|
||||||
import { FIRST_LOGIN_PARAM, TOKEN_COOKIE_NAME, setAuthToken } from '../../lib/jwt';
|
import {
|
||||||
|
FIRST_LOGIN_PARAM,
|
||||||
|
TOKEN_COOKIE_NAME,
|
||||||
|
setAuthToken,
|
||||||
|
} from '../../lib/jwt';
|
||||||
import { Spinner } from '../ReactIcons/Spinner';
|
import { Spinner } from '../ReactIcons/Spinner';
|
||||||
import { ErrorIcon2 } from '../ReactIcons/ErrorIcon2';
|
import { ErrorIcon2 } from '../ReactIcons/ErrorIcon2';
|
||||||
import { triggerUtmRegistration } from '../../lib/browser.ts';
|
import { triggerUtmRegistration } from '../../lib/browser.ts';
|
||||||
@@ -32,9 +36,10 @@ export function TriggerVerifyAccount() {
|
|||||||
setAuthToken(response.token);
|
setAuthToken(response.token);
|
||||||
|
|
||||||
const url = new URL('/', window.location.origin);
|
const url = new URL('/', window.location.origin);
|
||||||
if (response?.isNewUser) {
|
url.searchParams.set(
|
||||||
url.searchParams.set(FIRST_LOGIN_PARAM, '1');
|
FIRST_LOGIN_PARAM,
|
||||||
}
|
response?.isNewUser ? '1' : '0',
|
||||||
|
);
|
||||||
window.location.href = url.toString();
|
window.location.href = url.toString();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
Reference in New Issue
Block a user