2025-01-29 16:00:01 +01:00
|
|
|
export default defineNuxtRouteMiddleware(async () => {
|
2024-08-26 18:24:56 +02:00
|
|
|
const authStore = useAuthStore()
|
2025-01-29 16:00:01 +01:00
|
|
|
const featureFlagsStore = useFeatureFlagsStore()
|
|
|
|
|
|
|
|
|
|
// Ensure feature flags are loaded
|
|
|
|
|
if (!featureFlagsStore.isLoaded) {
|
|
|
|
|
await featureFlagsStore.fetchFlags()
|
|
|
|
|
}
|
2024-08-26 18:24:56 +02:00
|
|
|
|
2024-08-27 16:49:43 +02:00
|
|
|
if (useFeatureFlag('self_hosted')) {
|
2024-08-26 18:24:56 +02:00
|
|
|
if (authStore.check && authStore.user?.email === 'admin@opnform.com') {
|
|
|
|
|
return navigateTo({ name: "update-credentials" })
|
2024-08-05 12:06:20 +02:00
|
|
|
}
|
2024-08-26 18:24:56 +02:00
|
|
|
}
|
|
|
|
|
})
|