diff --git a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx index f19a89f4..0dc12583 100644 --- a/src/components/Nav/AuthModal/ForgotPasswordForm.tsx +++ b/src/components/Nav/AuthModal/ForgotPasswordForm.tsx @@ -22,7 +22,7 @@ export const ForgotPasswordForm = () => { setValidationErrors(({ email: _notNeeded, ...rest }) => rest) setEmail(newEmail) } - + const [sended, setSended] = createSignal(false) const [submitError, setSubmitError] = createSignal('') const [isSubmitting, setIsSubmitting] = createSignal(false) const [validationErrors, setValidationErrors] = createSignal({}) @@ -53,6 +53,7 @@ export const ForgotPasswordForm = () => { try { const result = await signSendLink({ email: email(), lang: locale() }) if (result.error) setSubmitError(result.error) + else setSended(true) } catch (error) { setSubmitError(error.message) } finally { @@ -63,7 +64,12 @@ export const ForgotPasswordForm = () => { return (

{t('Forgot password?')}

-
{t('Everything is ok, please give us your email address')}
+ {t('Link sent, check your email')}} + > +
{t('Everything is ok, please give us your email address')}
+
    diff --git a/src/stores/auth.ts b/src/stores/auth.ts index 9662ebe8..5b07ad25 100644 --- a/src/stores/auth.ts +++ b/src/stores/auth.ts @@ -11,11 +11,15 @@ export const signIn = async (params) => { setToken(authResult.token) console.debug('signed in') } -export const signOut = () => { - // TODO: call backend to revoke token - setSession(null) - resetToken() - console.debug('signed out') +export const signOut = async () => { + const result = await apiClient.authSignOut() + if (result.error) { + console.error('[auth] sign out error', result.error) + } else { + setSession(null) + resetToken() + console.debug('signed out') + } } export const [emailChecks, setEmailChecks] = createSignal<{ [email: string]: boolean }>({})