trandaison / nuxt-3-auth

A simple authentication module for Nuxt 3
https://nuxt-3-auth.github.io
57 stars 5 forks source link

Use a layout with a custom login page #29

Closed despatates closed 1 month ago

despatates commented 1 month ago

Hi,

First, thank you for your module, I was waiting for a translation of nuxt/auth-module for Nuxt v3!

I'm trying to use a custom login page using the routes configuration. My login page uses a layout, and this layout is not used but the default layout is.

In nuxt.conf.js:

  auth: {
    // [ ... ]
    routes: {
      login: {
        name: 'login',
        path: '/login',
        file: resolve(__dirname, './pages/login.vue'),
      },
      // [ ... ]
    },
  }

In my page pages/login.vue, I defined the layout:

definePageMeta({
  auth: false,
  layout: 'login',
})

Here is my layout in layouts/login.vue:

<template>
  <v-app>
    <v-container fluid>
      <v-row justify="center">
        <v-col cols="12" sm="10" md="6" xl="4">
          <v-sheet class="ma-2 pa-2">
            <v-card class="l-login">
              <NuxtPage />
            </v-card>
          </v-sheet>
        </v-col>
      </v-row>
    </v-container>
  </v-app>
</template>

The layout was working before installing your module. Any idea why it doesn't work?

trandaison commented 1 month ago

Hi!

Can you create a reproduction repository on https://stackblitz.com?

btw, auth value should be "guest" in definePageMeta instead of false

despatates commented 1 month ago

Here it is: https://stackblitz.com/edit/nuxt-starter-gmwxix?file=nuxt.config.ts

trandaison commented 1 month ago

@despatates That's weird. I did use a custom layout for the custom login page in the past, everything worked just fine. I found that it is still working with Nuxt 3.11.2, but not with the latest version. This should be a bug belongs to Nuxt itself, perhaps you can report it to the Nuxt team.

despatates commented 4 weeks ago

As layouts work fine when not using your plugin, I'm pretty sure they will reply it's a plugin issue.

https://github.com/nuxt/nuxt/issues/29361 Could you provide some support if they ask for technical data please?