Fixed sign in redirect on success

This commit is contained in:
Dmitriy Shishkov 2023-07-29 18:11:05 +03:00
parent ef94349341
commit e214ea53e7
Signed by: dm1sh
GPG Key ID: 027994B0AA357688
3 changed files with 14 additions and 4 deletions

View File

@ -26,9 +26,11 @@ function AuthForm({ goBack, register }: AuthFormProps) {
) : true
if (accountCreated) {
await handleSignIn(composeSignInBody(formData))
goBack()
if (await handleSignIn(composeSignInBody(formData))) {
goBack()
}
}
})()
}, [register, goBack, handleSignUp, handleSignIn])
@ -61,7 +63,7 @@ function AuthForm({ goBack, register }: AuthFormProps) {
<Form.Check>
<Form.Check.Input type='checkbox' required />
<Form.Check.Label>
Я согласен с <a href={`${document.location.origin}/privacy_policy.pdf`} target='_blank' rel='noopener noreferrer'>условиями обработки персональных данных</a>
Я согласен с <a href={`${document.location.origin}/privacy_policy.pdf`} target='_blank'>условиями обработки персональных данных</a>
</Form.Check.Label>
</Form.Check>
</Form.Group>

View File

@ -22,7 +22,11 @@ function useSignIn() {
if (token !== undefined) {
setToken(token)
return true
}
return false
}
return { handleSignIn, signInButton: button }

View File

@ -74,7 +74,11 @@ function useSend<R, T extends NonNullable<unknown>>(
} catch (err) {
if (err instanceof Error && !isAborted(err)) {
setError('Ошибка сети')
if (err instanceof TypeError) {
setError('Ошибка сети')
} else {
setError(err.message)
}
if (import.meta.env.DEV) {
console.log(url, params, err)