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