Skip to content

Commit b629dbe

Browse files
committed
fix: updateUser에서 updateUserPassword로 함수명 수정
1 parent 597d1ab commit b629dbe

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

src/apis/updateUserApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import supabase from '@/supabase';
22

3-
const updateUser = async (password: string) => {
3+
const updateUserPassword = async (password: string) => {
44
const { data, error } = await supabase.auth.updateUser({ password });
55

66
if (error) {
@@ -10,4 +10,4 @@ const updateUser = async (password: string) => {
1010
return data;
1111
};
1212

13-
export default updateUser;
13+
export default updateUserPassword;

src/components/ChangePassword/ChangePasswordButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Loading } from '@/pages';
22
import Dialog from '../Dialog';
3-
import useUpdateUser from '@/react-queries/useUpdateUser';
3+
import useUpdateUserPassword from '@/react-queries/useUpdateUserPassword';
44
const ChangePasswordButton = () => {
5-
const { onClick, dialogRef, dialogMessage, isPending } = useUpdateUser();
5+
const { onClick, dialogRef, dialogMessage, isPending } = useUpdateUserPassword();
66

77
return (
88
<>

src/react-queries/useUpdateUser.ts renamed to src/react-queries/useUpdateUserPassword.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { isLogIn } from '@/apis/authApis';
2-
import updateUser from '@/apis/updateUserApi';
2+
import updateUserPassword from '@/apis/updateUserApi';
33
import { useChangePasswordState } from '@/stores/changePasswordStore';
44
import supabase from '@/supabase';
55
import { LooseValidation, ValidateProcessor } from '@/utils/authUtils';
@@ -12,10 +12,10 @@ interface DialogElement {
1212
closeModal: () => void;
1313
}
1414

15-
const useUpdateUser = () => {
15+
const useUpdateUserPassword = () => {
1616
const { mutate, isPending } = useMutation({
17-
mutationKey: ['updateUser'],
18-
mutationFn: updateUser,
17+
mutationKey: ['updateUserPassword'],
18+
mutationFn: updateUserPassword,
1919
});
2020
const [dialogMessage, setDialogMessage] = useState('');
2121
const { password } = useChangePasswordState();
@@ -52,4 +52,4 @@ const useUpdateUser = () => {
5252
};
5353
};
5454

55-
export default useUpdateUser;
55+
export default useUpdateUserPassword;

src/tests/ChangePassword.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import supabase from '@/supabase';
22
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
3-
import { updateUserResponseFixture } from './fixtures/userFixture';
3+
import { updateUserPasswordResponseFixture } from './fixtures/userFixture';
44
import { AuthError } from '@supabase/supabase-js';
55
import { act, render, screen, waitFor } from '@testing-library/react';
66
import ChangePasswordForm from '@/components/ChangePassword/ChangePasswordForm';
@@ -22,7 +22,7 @@ describe('ChangePassword', async () => {
2222
const user = userEvent.setup();
2323
vi.mocked(supabase.auth.updateUser).mockResolvedValue({
2424
data: {
25-
user: updateUserResponseFixture,
25+
user: updateUserPasswordResponseFixture,
2626
},
2727
error: null,
2828
});
@@ -49,7 +49,7 @@ describe('ChangePassword', async () => {
4949

5050
vi.mocked(supabase.auth.updateUser).mockResolvedValue({
5151
data: {
52-
user: updateUserResponseFixture,
52+
user: updateUserPasswordResponseFixture,
5353
},
5454
error: null,
5555
});

src/tests/fixtures/userFixture.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { User } from '@supabase/supabase-js';
22

3-
export const updateUserResponseFixture: User = {
3+
export const updateUserPasswordResponseFixture: User = {
44
id: '1d7a5662-922e-4167-932d-4dda46f67ef2',
55
aud: 'authenticated',
66
role: 'authenticated',

0 commit comments

Comments
 (0)