我找不到包含以下内容的示例,在获取之后,我需要使用react-test-mock在打字稿中进行模拟
useEffect(() => {
fetch(
`${config.baseUrl}/${config.apiVersion}/countapplications`
)
.then((res) => res.json())
.then((data) => {
tokenizeStatus(data);
setStatusResult(data);
});
// eslint-disable-next-line
}, []);
获取控制台-
console.log(fetch(
`${config.baseUrl}/${config.apiVersion}/countapplications`
).then((res) => res.json()));
给予-
Promise {<pending>}
__proto__: Promise
[[PromiseState]]: "fulfilled"
[[PromiseResult]]: Array(5)
0: {status: "Incomplete", count: 14}
1: {status: "Submitted", count: 6}
2: {status: "Interview", count: 3}
3: {status: "Pre-onboard", count: 0}
4: {status: "Offer", count: 1}
length: 5
__proto__: Array(0)