Skip to content

Commit

Permalink
fix: 코드리뷰 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
SongInjae committed Oct 25, 2023
1 parent c8c9e92 commit 7b12b7d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 16 deletions.
13 changes: 0 additions & 13 deletions src/apis/users/createUser.ts

This file was deleted.

13 changes: 13 additions & 0 deletions src/apis/users/postUser.ts
Original file line number Diff line number Diff line change
@@ -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;
1 change: 1 addition & 0 deletions src/constants/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
3 changes: 2 additions & 1 deletion src/mocks/users.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { END_POINTS } from '@/constants/api';
import { HttpResponse, http } from 'msw';

interface member {
Expand All @@ -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 = '';

Expand Down
4 changes: 2 additions & 2 deletions src/pages/RegisterPage/RegisterPage.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -40,7 +40,7 @@ const RegisterPage = () => {
const handleSubmit = async (e: MouseEvent<HTMLButtonElement>) => {
e.preventDefault();

await createUser({ name, number });
await postUser({ name, number });

navigate('/');
};
Expand Down

0 comments on commit 7b12b7d

Please sign in to comment.