问题
In my react-redux application, i have used many libraries especially babel 6.4.1 which i could not upgrade it, webpack 4, polyfill and hundreds of other libraries, anyway; At the lates state i am calling an api in front-end and api returning true result for a method but i have seen extra codes after the methods in chrome webpack dev-tools sources. Which effecting my codes and application does not run stable for this reason. I have researched all google but couldn't understand why?
My function's orginal status in vscode:
export const loginUser = (data, callback) => async (dispatch, getState) => {
const response = await api.ajax.login.retrieve(data);
let decodedJSON = Buffer.from(response.json, 'base64').toString('ascii');
decodedJSON = JSON.parse(decodedJSON);
dispatch(handleAccountProperties(decodedJSON));
if (decodedJSON.authenticated) {
data.history.push('/customer-account');
}
};
and this is in chrome source console
var loginUser = function loginUser(data, callback) {return (/*#__PURE__*/function () {var _ref12 = Object(_babel_runtime_helpers_esm_asyncToGenerator__WEBPACK_IMPORTED_MODULE_9__["default"])( /*#__PURE__*/_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_7___default.a.mark(function _callee12(dispatch, getState) {var response, decodedJSON;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_7___default.a.wrap(function _callee12$(_context12) {while (1) {switch (_context12.prev = _context12.next) {case 0:_context12.next = 2;return (
_client_api__WEBPACK_IMPORTED_MODULE_14__["default"].ajax.login.retrieve(data));case 2:response = _context12.sent;
decodedJSON = Buffer.from(response.json, 'base64').toString('ascii');
decodedJSON = JSON.parse(decodedJSON);
dispatch(handleAccountProperties(decodedJSON));
if (decodedJSON.authenticated) {
data.history.push('/customer-account');
}case 7:case "end":return _context12.stop();}}}, _callee12, this);}));return function (_x23, _x24) {return _ref12.apply(this, arguments);};}());};
the line begins with "case 7" nope in code in normally but added after transpile or generating but why i do not understand? It has preventing history.push navigation
来源:https://stackoverflow.com/questions/55109997/what-is-this-code-case-6case-endreturn-context15-stop-babel-react-redux-w