-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from traPtitech/feat/msw_update
mswをv2にした
- Loading branch information
Showing
13 changed files
with
437 additions
and
544 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
import { rest } from 'msw' | ||
import { HttpResponse, type PathParams, http } from 'msw' | ||
|
||
const mockAdmins = ['3fa85f64-5717-4562-b3fc-2c963f66afa6'] | ||
|
||
export const adminHandlers = [ | ||
rest.get('/api/admins', (req, res, ctx) => { | ||
return res(ctx.status(200), ctx.json<string[]>(mockAdmins)) | ||
http.get('/api/admins', () => { | ||
return HttpResponse.json(mockAdmins) | ||
}), | ||
rest.post('/api/admins', async (req, res, ctx) => { | ||
const reqBody: string[] = await req.json() | ||
return res(ctx.status(200), ctx.json<string[]>(reqBody)) | ||
}), | ||
rest.delete('/api/admins', (req, res, ctx) => { | ||
return res(ctx.status(200)) | ||
http.post<PathParams, string[], string[]>( | ||
'/api/admins', | ||
async ({ request }) => { | ||
const reqBody: string[] = await request.json() | ||
return HttpResponse.json(reqBody) | ||
} | ||
), | ||
http.delete('/api/admins', () => { | ||
return HttpResponse.json(null) | ||
}) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.