Next.js Discord

Discord Forum

production routing not reloading page to new url

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
I have a fetch that pushes route based on result status. But it does not push route when successful.

1 Reply

Brown bearOP
const playAsGuest = async () => {
        try {
            const result = await fetch('/api/guest', {
                method: 'POST',
                credentials: 'include',
            });
            if (result.ok) {
                router.push('/multiplayer');
                return;
            }
        } catch (error) {
            console.log(error);
        }
    };