sendlink-template-patch
This commit is contained in:
parent
238449ba1d
commit
013bdd48d0
|
@ -54,7 +54,7 @@ export const ForgotPasswordForm = () => {
|
|||
setIsSubmitting(true)
|
||||
|
||||
try {
|
||||
await signSendLink({ email: email(), lang: locale() })
|
||||
await signSendLink({ email: email(), lang: locale(), template: 'forgot_password' })
|
||||
} catch (error) {
|
||||
if (error instanceof ApiError && error.code === 'user_not_found') {
|
||||
setIsUserNotFound(true)
|
||||
|
|
|
@ -50,7 +50,7 @@ export const LoginForm = () => {
|
|||
setIsEmailNotConfirmed(false)
|
||||
setSubmitError('')
|
||||
setIsLinkSent(true)
|
||||
const result = await signSendLink({ email: email(), lang: locale() })
|
||||
const result = await signSendLink({ email: email(), lang: locale(), template: 'email_confirmation' })
|
||||
if (result.error) setSubmitError(result.error)
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { gql } from '@urql/core'
|
||||
|
||||
export default gql`
|
||||
mutation SendLinkQuery($email: String!, $lang: String) {
|
||||
sendLink(email: $email, lang: $lang) {
|
||||
mutation SendLinkQuery($email: String!, $lang: String, $template: String) {
|
||||
sendLink(email: $email, lang: $lang, template: $template) {
|
||||
error
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,14 @@ export const register = async ({
|
|||
})
|
||||
}
|
||||
|
||||
export const signSendLink = async ({ email, lang }: { email: string; lang: string }) => {
|
||||
return await apiClient.authSendLink({ email, lang })
|
||||
export const signSendLink = async ({
|
||||
email,
|
||||
lang,
|
||||
template
|
||||
}: {
|
||||
email: string
|
||||
lang: string
|
||||
template: string
|
||||
}) => {
|
||||
return await apiClient.authSendLink({ email, lang, template })
|
||||
}
|
||||
|
|
|
@ -112,9 +112,11 @@ export const apiClient = {
|
|||
const response = await publicGraphQLClient.query(authCheckEmailQuery, { email }).toPromise()
|
||||
return response.data.isEmailUsed
|
||||
},
|
||||
authSendLink: async ({ email, lang }) => {
|
||||
authSendLink: async ({ email, lang, template }) => {
|
||||
// send link with code on email
|
||||
const response = await publicGraphQLClient.mutation(authSendLinkMutation, { email, lang }).toPromise()
|
||||
const response = await publicGraphQLClient
|
||||
.mutation(authSendLinkMutation, { email, lang, template })
|
||||
.toPromise()
|
||||
|
||||
if (response.error) {
|
||||
if (response.error.message === '[GraphQL] User not found') {
|
||||
|
|
Loading…
Reference in New Issue
Block a user