mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
* Fix preview error with page parameter * Fix OIDC form support * Fix input border color * Fix some builder inputs * Clear some TODO MIGs * Clean comments * Update snapshot * Fix page title * Fix reactivity issue * refactor: replace individual RadioButtons with a RadioGroup component for choice option type selection. * Fix domain --------- Co-authored-by: Jonathan Adeline <jonathan@baserow.io>
22 lines
665 B
JavaScript
22 lines
665 B
JavaScript
/**
|
|
* If this middleware is added to a page, it will redirect back to the login
|
|
* page if the user is not authenticated.
|
|
*/
|
|
export default defineNuxtRouteMiddleware((to) => {
|
|
const nuxtApp = useNuxtApp()
|
|
const store = nuxtApp.$store
|
|
const event = import.meta.server ? useRequestEvent() : null
|
|
|
|
if (import.meta.server && !event) return
|
|
|
|
if (!store.getters['auth/isAuthenticated']) {
|
|
const original =
|
|
import.meta.server && event?.node?.req
|
|
? event.node.req.originalUrl || event.node.req.url || to.fullPath
|
|
: to.fullPath
|
|
const query = { original: encodeURI(original) }
|
|
|
|
return navigateTo({ name: 'login', query })
|
|
}
|
|
})
|