Skip to content

Commit

Permalink
feat: 응답 시간 변수 적용
Browse files Browse the repository at this point in the history
  • Loading branch information
BangDori committed May 10, 2024
1 parent 6a18f2e commit d145227
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/app/mocks/dir/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import { HttpResponse, delay } from 'msw';

import { errorMessage } from '../consts/error';

/** 0 <= 응답 시간 <= 4초 */
const delayTime = Math.random() * 4001;

export async function createHttpSuccessResponse<T>(data: T) {
await delay();
await delay(delayTime);

return HttpResponse.json(
{
Expand All @@ -15,7 +18,7 @@ export async function createHttpSuccessResponse<T>(data: T) {
}

export async function createHttpErrorResponse(code: keyof typeof errorMessage) {
await delay();
await delay(delayTime);

return HttpResponse.json(
{
Expand Down

0 comments on commit d145227

Please sign in to comment.