98 lines
2.9 KiB
TypeScript
98 lines
2.9 KiB
TypeScript
// https://nuxt.com/docs/api/configuration/nuxt-config
|
|
import type { NuxtPage } from 'nuxt/schema'
|
|
import clientsideConfig from './clientsideConfig'
|
|
import { UserObjectDefinition } from './composables/UserObject'
|
|
|
|
export default defineNuxtConfig({
|
|
devtools: { enabled: true },
|
|
modules: [
|
|
'@pinia/nuxt',
|
|
'@sidebase/nuxt-auth',
|
|
],
|
|
auth: {
|
|
//baseURL: `https://${clientsideConfig.url}:${clientsideConfig.port}/.output/server/chunks/routes/api/auth`,
|
|
computed: {
|
|
origin: `https://${clientsideConfig.url}:${clientsideConfig.port}/`,
|
|
//pathname: '/server/chunks/routes/api/auth/',
|
|
//fullBaseUrl: `https://${clientsideConfig.url}:${clientsideConfig.port}/server/chunks/routes/api/auth/`,
|
|
},
|
|
//baseUrl: `https://${clientsideConfig.url}:${clientsideConfig.port}/server/chunks/routes/api/auth/`,
|
|
provider: {
|
|
type: 'refresh',
|
|
endpoints: {
|
|
signIn: { path: '/login', method: 'post' },
|
|
signOut: { path: '/logout', method: 'get' },
|
|
signUp: { path: '/signup', method: 'post' },
|
|
getSession: { path: '/session', method: 'get' },
|
|
refresh: { path: '/refresh', method: 'post' }
|
|
},
|
|
token: {
|
|
signInResponseTokenPointer: '/token/authToken',
|
|
maxAgeInSeconds: 300, // 5 min
|
|
sameSiteAttribute: 'lax'
|
|
},
|
|
refreshToken: {
|
|
signInResponseRefreshTokenPointer: '/token/refreshToken',
|
|
maxAgeInSeconds: 604800, // 7 days
|
|
sameSiteAttribute: 'lax'
|
|
},
|
|
// TODO: define UserObject
|
|
//sessionDataType: UserObjectDefinition,
|
|
},
|
|
session: {
|
|
enableRefreshPeriodically: false,
|
|
enableRefreshOnWindowFocus: true,
|
|
},
|
|
globalAppMiddleware: true,
|
|
},
|
|
/*buildModules: [
|
|
//'@nuxtjs/composition-api/module',
|
|
['@pinia/nuxt', { disableVuex: false }],
|
|
],*/
|
|
devServer: {
|
|
https: {
|
|
key: './certs/privkey.pem',
|
|
cert: './certs/fullchain.pem'
|
|
}
|
|
},
|
|
vite: {
|
|
server: {
|
|
cors: {
|
|
origin: true,
|
|
credentials: true,
|
|
optionsSuccessStatus: 204,
|
|
},
|
|
}
|
|
},
|
|
runtimeConfig: {
|
|
public: {
|
|
apiBase: `https://${clientsideConfig.url}:${clientsideConfig.port}/server/chunks/routes/api`,
|
|
axios: {
|
|
browserBaseURL: `https://${clientsideConfig.url}:${clientsideConfig.port}/`,
|
|
},
|
|
},
|
|
private: {
|
|
axios: {
|
|
baseURL: `https://${clientsideConfig.url}:${clientsideConfig.port}/`,
|
|
}
|
|
}
|
|
},
|
|
// hooks: {
|
|
// 'pages:extend'(pages) {
|
|
// function setMiddleware(pages: NuxtPage[]) {
|
|
// for (const page of pages) {
|
|
// if (/* some condition */ true) {
|
|
// page.meta ||= {}
|
|
// // Note that this will override any middleware set in `definePageMeta` in the page
|
|
// page.meta.middleware = ['auth']
|
|
// }
|
|
// if (page.children) {
|
|
// setMiddleware(page.children)
|
|
// }
|
|
// }
|
|
// }
|
|
// setMiddleware(pages)
|
|
// }
|
|
// }
|
|
})
|