diff --git a/src/apis/users/createUser.ts b/src/apis/users/createUser.ts deleted file mode 100644 index 8ef6622f..00000000 --- a/src/apis/users/createUser.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { axiosClient } from '@/apis/axiosClient'; - -export interface createUser { - name: string; - number: string; -} - -const createUser = async ({ name, number }: createUser) => { - const { data } = await axiosClient.post('/register', { name, number }); - return data; -}; - -export default createUser; diff --git a/src/apis/users/postUser.ts b/src/apis/users/postUser.ts new file mode 100644 index 00000000..ce5701ac --- /dev/null +++ b/src/apis/users/postUser.ts @@ -0,0 +1,13 @@ +import { axiosClient } from '@/apis/axiosClient'; +import { END_POINTS } from '@/constants/api'; + +export interface createUser { + name: string; + number: string; +} + +const postUser = async ({ name, number }: createUser) => { + await axiosClient.post(END_POINTS.REGISTER, { name, number }); +}; + +export default postUser; diff --git a/src/constants/api.ts b/src/constants/api.ts index c4c01ce9..554c2e7f 100644 --- a/src/constants/api.ts +++ b/src/constants/api.ts @@ -4,6 +4,7 @@ const NETWORK_TIMEOUT = 10000; const END_POINTS = { KAKAO_LOGIN: '/login/kakao', + REGISTER: '/users', }; export { SPACECLUB_BASE_URL, NETWORK_TIMEOUT, END_POINTS }; diff --git a/src/mocks/users.ts b/src/mocks/users.ts index 55702cf3..ab513ae9 100644 --- a/src/mocks/users.ts +++ b/src/mocks/users.ts @@ -1,3 +1,4 @@ +import { END_POINTS } from '@/constants/api'; import { HttpResponse, http } from 'msw'; interface member { @@ -8,7 +9,7 @@ interface member { const members: member[] = []; export const userHandlers = [ - http.post('/register', async ({ request }) => { + http.post(END_POINTS.REGISTER, async ({ request }) => { const reader = request.body?.getReader(); let data = ''; diff --git a/src/pages/RegisterPage/RegisterPage.tsx b/src/pages/RegisterPage/RegisterPage.tsx index dcef0073..9af59c33 100644 --- a/src/pages/RegisterPage/RegisterPage.tsx +++ b/src/pages/RegisterPage/RegisterPage.tsx @@ -1,4 +1,4 @@ -import createUser from '@/apis/users/createUser'; +import postUser from '@/apis/users/postUser'; import InputForm from '@/components/common/InputForm/InputForm'; import { ChangeEvent, MouseEvent, useEffect, useRef, useState } from 'react'; @@ -40,7 +40,7 @@ const RegisterPage = () => { const handleSubmit = async (e: MouseEvent) => { e.preventDefault(); - await createUser({ name, number }); + await postUser({ name, number }); navigate('/'); };