docs: fix

This commit is contained in:
Acid Chicken (硫酸鶏) 2023-03-25 20:19:20 +09:00
parent 899c6241c3
commit 225a8e11a9
No known key found for this signature in database
GPG Key ID: 3E87B98A3F6BAB99
1 changed files with 2 additions and 6 deletions

View File

@ -268,18 +268,14 @@ import MyComponent from './MyComponent.vue';
void MyComponent; void MyComponent;
``` ```
You can use msw to mock API requests in the storybook. Creating a `MyComponent.stories.msw.ts` file and add the following line to the file. You can use msw to mock API requests in the storybook. Creating a `MyComponent.stories.msw.ts` file to define the mock handlers.
```ts ```ts
import { rest } from 'msw'; import { rest } from 'msw';
export const handlers = [ export const handlers = [
rest.post('/api/notes/timeline', (req, res, ctx) => { rest.post('/api/notes/timeline', (req, res, ctx) => {
return res( return res(
ctx.json({ ctx.json([]),
notes: [],
users: [],
hasNext: false,
})
); );
}), }),
]; ];