【发布时间】:2020-05-31 11:35:49
【问题描述】:
我在玩 nextjs 我很难调试一个像 这个:
export const authInitialProps = isProtectedRoute => {
console.log("mylog");// this works
return ({ req, res }) => {
console.log("inner my log", req); // this doesn't work
};
};
在页面中使用
ProfilePage.getInitialProps = async () => {
const auth = authInitialProps(true);
if (!typeof auth === "function") {
const user = await getUserProfile();
return { user };
}
return { user: null };
};
我从来没有在 chrome 控制台中看到“inner my log” 在我的控制台终端中。 请问有什么问题?
【问题讨论】:
标签: next.js