Login:App:Confirm: fix handling of getUserByEmail request results

This commit is contained in:
Darya Umrikhina 2024-07-24 17:47:32 +04:00
parent 283e7b221e
commit 780252f9f1

View File

@ -70,26 +70,22 @@ export default function withLoader<T extends WithLoaderProps>(
const getData = useCallback(async () => { const getData = useCallback(async () => {
if (type === "EmpInvite" && email) { if (type === "EmpInvite" && email) {
try { const response = await getUserByEmail(email, confirmHeader);
const response = await getUserByEmail(email, confirmHeader);
if (response) { if (response !== 404) {
const loginData = window.btoa( const loginData = window.btoa(
JSON.stringify({ JSON.stringify({
type: "invitation", type: "invitation",
email: email, email: email,
}), }),
); );
window.location.href = combineUrl( window.location.href = combineUrl(
window.ClientConfig?.proxy?.url, window.ClientConfig?.proxy?.url,
"/login", "/login",
`?loginData=${loginData}`, `?loginData=${loginData}`,
); );
} }
return;
} catch (e) {}
} }
try { try {