Files
listas_frontend_nuxt/nuxt.config.ts
clonbg b607380a68 Refactor auth middleware and add logout functionality
Since there are multiple significant changes, a message body is
warranted:

- Replace token refresh logic with simple route protection - Move cookie
deletion to new system store - Add logout button and handler to index
page - Rename Chuck Norris store for consistency
2025-08-11 15:22:39 +02:00

54 lines
1.6 KiB
TypeScript

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
compatibilityDate: "2025-07-15",
ssr: false,
devtools: { enabled: false },
modules: ["@pinia/nuxt", "@sidebase/nuxt-auth"],
runtimeConfig: {
baseURL: "http://localhost:3000",
},
auth: {
globalAppMiddleware: false,
baseURL: "http://localhost:8000/auth",
provider: {
type: "local",
token: {
signInResponseTokenPointer: "/access",
type: "JWT",
headerName: "Authorization",
cookieName: "authls.atoken",
maxAgeInSeconds: 30 * 59,
},
refresh: {
isEnabled: true,
endpoint: { path: "/jwt/refresh/", method: "post" },
refreshOnlyToken: false,
token: {
signInResponseRefreshTokenPointer: "/refresh",
refreshResponseTokenPointer: "/access",
refreshRequestTokenPointer: "/refresh",
cookieName: "authls.rtoken",
maxAgeInSeconds: 60 * 60 * 23, // En 23 horas refresca automáticamente
sameSiteAttribute: "strict",
},
},
endpoints: {
signIn: { path: "/jwt/create/", method: "post" },
signOut: false,
signUp: { path: "/users/", method: "post" },
getSession: { path: "/users/me/", method: "get" },
},
pages: {
login: "/login",
},
sessionDataType: {},
},
enableSessionRefreshPeriodically: 5000,
enableSessionRefreshOnWindowFocus: true,
},
css: ["vuetify/styles", "@mdi/font/css/materialdesignicons.min.css"],
plugins: ["~/plugins/vuetify.js"],
components: true,
});