[英]How to write this function in ES6 fat arrow?
I want to rewrite this function in to ES6 fat arrow, but not sure how? 我想将此功能重写为ES6粗箭头,但不确定如何?
passport.authenticate("local")(req, res, function(){
res.redirect("/secret");
});
I thought this might be the way but nope: 我以为可能是这样,但不是:
passport.authenticate("local")((req, res)=>{
res.redirect("/secret");
});
passport.authenticate("local")(req, res, () => {
res.redirect("/secret");
});
It can be done this way. 可以通过这种方式完成。
如果您不打算在箭头功能中进行任何其他操作,则可以这样做。
passport.authenticate("local")(req, res, () => res.redirect("/secret"));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.