Skip to content

Commit

Permalink
feat: (#55) msw로 글 작성/수정 API 모킹
Browse files Browse the repository at this point in the history
  • Loading branch information
inyeong-kang committed Jul 18, 2023
1 parent 40cc1ae commit e9dd9de
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
3 changes: 2 additions & 1 deletion frontend/src/mocks/handlers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { example } from './example/get';
import { createEditPostTest } from './jero/post';
import { votePostTest } from './sua/vote';

export const handlers = [...example, ...votePostTest];
export const handlers = [...example, ...votePostTest, ...createEditPostTest];
17 changes: 17 additions & 0 deletions frontend/src/mocks/jero/post.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { rest } from 'msw';

export const createEditPostTest = [
//게시글 작성
rest.post('/posts', (req, res, ctx) => {
window.console.log('게시글 작성 완료', req.body);

return res(ctx.status(201));
}),

//게시글 수정
rest.put('/posts/1', (req, res, ctx) => {
window.console.log('게시글 수정 완료', req.body);

return res(ctx.status(200));
}),
];

0 comments on commit e9dd9de

Please sign in to comment.