Closed YnievesDotNet closed 3 years ago
Other think, I can put the code as JS only and publish static code, in the laravel public directory?
Hi @YnievesDotNet , thanks for creating the issue :)!
I pushed a fix regarding your problems when running the build command. You can take the changes from the commit, but here is the gist of it:
Under pages/user/email/verify/[userID]/[hash].tsx
the callback in the useEffect
function may not be async. As you probably didn't fork the repo the easiest way for you to adapt the change is to copy the following code from line 34 onwards:
// Send api request to api upon mount of the component.
useEffect(() => {
const verify = async () => {
const res = await props.verifyEmail(
userID,
hash,
expires,
signature
);
// Successfull verification.
if (res.success) {
setState({
...state,
loading: false,
error: "",
});
// Redirect to Home route of the user after 3 seconds.
setTimeout(() => {
router.push(process.env.NEXT_PUBLIC_USER_HOME_ROUTE);
}, 3000);
return;
}
// Set error message if verification failed.
if (res.error) {
setState({
...state,
loading: false,
error: res.error,
});
}
};
verify();
}, []);
Next, there was a small mistake at pages/user/login.tsx
. In line line 56, please change the return type from ReactElement
to void
Finally please delete the file store/alert/alertActions.tsx
.
The build should now work as expected.
Regarding your second question:
As stated in the docs, the repo does currently not support static generation due to the way Next.js works. We're dealing with a lot of dynamic data and have to reload the user every time the page refreshes. This forces us to use getInitialProps
in _app.tsx
, which disqualifies us from SSG. For reference see here: https://nextjs.org/docs/api-reference/data-fetching/getInitialProps
Hope this helps!
Thanks again for reaching out and best regards, Niclas
Now have "CSRF token mismatch." error when try register
I have error when I run the command
npm run build
How I can fix that?
Thanks