Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(signup): pass langauge to sign up mutations #3863

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/components/Forms/EmailLoginForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ export const EmailLoginForm: React.FC<FormProps> = ({
try {
setIsSubmitting(true)
const { data } = await login({
variables: { input: { email, passwordOrCode: password } },
variables: {
input: { email, passwordOrCode: password, language: lang },
},
})

const token = data?.emailLogin.token || ''
Expand Down
6 changes: 2 additions & 4 deletions src/components/Forms/WalletAuthForm/Connect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ const Connect: React.FC<FormProps> = ({
if (isLogin) {
// confirm auth
const { data: loginData } = await walletLogin({
variables,
variables: { input: { ...variables.input, language: lang } },
})

const token = loginData?.walletLogin.token || ''
Expand All @@ -216,9 +216,7 @@ const Connect: React.FC<FormProps> = ({
}

if (isConnect) {
await addWalletLogin({
variables: variables,
})
await addWalletLogin({ variables })

toast.success({
message: (
Expand Down
6 changes: 4 additions & 2 deletions src/views/Callback/LoginCallback.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useEffect, useState } from 'react'
import { useContext, useEffect, useState } from 'react'

import {
COOKIE_LANGUAGE,
COOKIE_TOKEN_NAME,
COOKIE_USER_GROUP,
} from '~/common/enums'
import { redirectToTarget, setCookies } from '~/common/utils'
import { useMutation, useRoute } from '~/components'
import { LanguageContext, useMutation, useRoute } from '~/components'
import { EMAIL_LOGIN } from '~/components/GQL/mutations/emailLogin'
import { EmailLoginMutation } from '~/gql/graphql'

Expand All @@ -19,6 +19,7 @@ const LoginCallback = () => {
showToast: false,
})

const { lang } = useContext(LanguageContext)
const [hasError, setHasError] = useState(false)
const { getQuery } = useRoute()
const email = getQuery('email')
Expand All @@ -32,6 +33,7 @@ const LoginCallback = () => {
input: {
email,
passwordOrCode: code,
language: lang,
},
},
})
Expand Down
12 changes: 10 additions & 2 deletions src/views/Callback/SocialCallback.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'
import { useContext, useEffect, useState } from 'react'

import {
COOKIE_LANGUAGE,
Expand All @@ -14,7 +14,12 @@ import {
OAUTH_TYPE,
} from '~/common/enums'
import { analytics, setCookies, storage } from '~/common/utils'
import { getErrorCodes, useMutation, useRoute } from '~/components'
import {
getErrorCodes,
LanguageContext,
useMutation,
useRoute,
} from '~/components'
import {
AddSocialLoginMutation,
SocialAccountType,
Expand All @@ -41,6 +46,8 @@ const SocialCallback = ({ type }: Props) => {
showToast: false,
}
)
const { lang } = useContext(LanguageContext)

const [hasError, setHasError] = useState(false)
const { getQuery } = useRoute()
const state = getQuery('state')
Expand Down Expand Up @@ -73,6 +80,7 @@ const SocialCallback = ({ type }: Props) => {
nonce: localNonce,
codeVerifier: localCodeVerifier,
authorizationCode: code,
language: lang,
},
},
})
Expand Down
Loading