【发布时间】:2022-10-06 17:56:01
【问题描述】:
我正在尝试在使用 Typescript 时使用 msw 从模拟 api 调用中检索数据。我该怎么做呢?我不断收到 \"Property \'email\' 在类型 \'DefaultBodyType\'\ 上不存在"
处理程序
export const handlers: RestHandler[] = [
rest.post(`/${API_VERSION}/authentication/login`, (req, res, ctx) => {
const {email} = req.body;
console.log();
return res(
ctx.status(200),
ctx.json({
token: \"abdb23231232jdsaWEDwdxaCDA\",
expiresIn: 100000,
isEnabled: true,
isLocked: false,
})
);
})
];