Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/api/login | route cannot found after build project #211

Open
mertefecerit opened this issue Dec 11, 2024 · 0 comments
Open

/api/login | route cannot found after build project #211

mertefecerit opened this issue Dec 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@mertefecerit
Copy link

when run the project after build getting 500 error on nuxt server side, this logic working on dev and preview mode but not build.

[nuxt] [request error] [unhandled] [500] Invalid URL
[Vue Router warn]: No match found for location with path "/api/login"

Our Middleware (work on preview and dev mode not build)

export default defineNuxtRouteMiddleware(async () => {
    const client = useKindeClient();
    if (client) {
        const isAuth = await client.isAuthenticated();
        if (isAuth) {
            const token = await client.getToken();
            useState('token', () => token);
            return true;
        }else{
            useState('token', () => null);
            return navigateTo('/api/login', {external:true});
        }
    }
})

Testing these links (work on preview and dev mode not build)

<LoginLink to="/api/login" external>login</LoginLink>
<RegisterLink to="/api/register" external>register</RegisterLink>


<client-only>
  <LoginLink to="/api/login" external>login</LoginLink>
  <RegisterLink to="/api/register" external>register</RegisterLink>
<client-only>
@maige-app maige-app bot added the bug Something isn't working label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant