File tree Expand file tree Collapse file tree 3 files changed +10
-12
lines changed Expand file tree Collapse file tree 3 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import styled from 'styled-components';
6
6
import Button from '../common/Button' ;
7
7
import SettingEmailSuccess from './SettingEmailSuccess' ;
8
8
import { toast } from 'react-toastify' ;
9
- import { CHECK_DUPLICATED_EMAIL } from '../../lib/graphql/user' ;
9
+ import { EMAIL_EXISTS } from '../../lib/graphql/user' ;
10
10
import client from '../../lib/graphql/client' ;
11
11
12
12
export type SettingEmailRowProps = {
@@ -37,12 +37,12 @@ function SettingEmailRow({
37
37
}
38
38
39
39
const response = await client . query < { isDuplicated : boolean } > ( {
40
- query : CHECK_DUPLICATED_EMAIL ,
40
+ query : EMAIL_EXISTS ,
41
41
fetchPolicy : 'network-only' ,
42
42
variables : { email : value } ,
43
43
} ) ;
44
44
45
- if ( response . data . isDuplicated ) {
45
+ if ( response . data ) {
46
46
toast . error ( '동일한 이메일이 존재합니다.' ) ;
47
47
return ;
48
48
}
Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ import { useMutation } from '@apollo/react-hooks';
2
2
import gql from 'graphql-tag' ;
3
3
import { useCallback } from 'react' ;
4
4
5
- const TRY_CHANGE_EMAIL = gql `
6
- mutation TRY_CHANGE_EMAIL ($email: String!) {
7
- tryChangeEmail (email: $email)
5
+ const INITIATE_CHANGE_EMAIL = gql `
6
+ mutation INITIATE_CHANGE_EMAIL ($email: String!) {
7
+ initiateChangeEmail (email: $email)
8
8
}
9
9
` ;
10
10
11
11
export default function useChangeEmail ( ) {
12
- const [ changeEmail , { called } ] = useMutation ( TRY_CHANGE_EMAIL ) ;
12
+ const [ changeEmail , { called } ] = useMutation ( INITIATE_CHANGE_EMAIL ) ;
13
13
const change = useCallback (
14
14
( email : string ) => {
15
15
return changeEmail ( {
Original file line number Diff line number Diff line change @@ -130,11 +130,9 @@ export const GET_USER_SERIES_LIST = gql`
130
130
}
131
131
` ;
132
132
133
- export const CHECK_DUPLICATED_EMAIL = gql `
134
- query CHECK_DUPLICATED_EMAIL($email: String!) {
135
- checkDuplicatedEmail(email: $email) {
136
- isDuplicated
137
- }
133
+ export const EMAIL_EXISTS = gql `
134
+ query EMAIL_EXISTS($email: String!) {
135
+ emailExists(email: $email)
138
136
}
139
137
` ;
140
138
You can’t perform that action at this time.
0 commit comments