Я пытаюсь смоделировать вызов выборки в компоненте реагирующего приложения.Получение ошибки ExceptionsManager.js:74 _regenerator2.default.mark is not a function
.
mock.js
import fetchMock from "fetch-mock";
import querystring from "querystring";
fetchMock.mock(/\/cities.*/, url => {
// Gets the "filter" and "asc" parameters.
const params = querystring.parse(url.split("?")[1]);
// Performs the sorting and filtering before
// responding.
return {
items: [params.filter,params.asc]
};
});
index.js
import './mock';
const fetchItems = (filter, asc) =>
fetch(`/cities?filter=${filter}&asc=${+asc}`).then(resp => resp.json());
fetchItems(filter, asc).then(cities => {})
![enter image description here](https://i.stack.imgur.com/G6hmj.png)