Skip to content

Commit 522af16

Browse files
committed
fix: change variable name
1 parent 7112aaf commit 522af16

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

src/components/setting/SettingEmailRow.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import styled from 'styled-components';
66
import Button from '../common/Button';
77
import SettingEmailSuccess from './SettingEmailSuccess';
88
import { toast } from 'react-toastify';
9-
import { CHECK_DUPLICATED_EMAIL } from '../../lib/graphql/user';
9+
import { EMAIL_EXISTS } from '../../lib/graphql/user';
1010
import client from '../../lib/graphql/client';
1111

1212
export type SettingEmailRowProps = {
@@ -37,12 +37,12 @@ function SettingEmailRow({
3737
}
3838

3939
const response = await client.query<{ isDuplicated: boolean }>({
40-
query: CHECK_DUPLICATED_EMAIL,
40+
query: EMAIL_EXISTS,
4141
fetchPolicy: 'network-only',
4242
variables: { email: value },
4343
});
4444

45-
if (response.data.isDuplicated) {
45+
if (response.data) {
4646
toast.error('동일한 이메일이 존재합니다.');
4747
return;
4848
}

src/containers/setting/hooks/useChangeEmail.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import { useMutation } from '@apollo/react-hooks';
22
import gql from 'graphql-tag';
33
import { useCallback } from 'react';
44

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)
88
}
99
`;
1010

1111
export default function useChangeEmail() {
12-
const [changeEmail, { called }] = useMutation(TRY_CHANGE_EMAIL);
12+
const [changeEmail, { called }] = useMutation(INITIATE_CHANGE_EMAIL);
1313
const change = useCallback(
1414
(email: string) => {
1515
return changeEmail({

src/lib/graphql/user.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,9 @@ export const GET_USER_SERIES_LIST = gql`
130130
}
131131
`;
132132

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)
138136
}
139137
`;
140138

0 commit comments

Comments
 (0)