In Nuxt 3 page middleware is set by definePageMeta, however this is not available in Nuxt 2 Bridge.
In Nuxt 3 page middleware is set by definePageMeta, however this is not available in Nuxt 2 Bridge.
In Nuxt 2 Bridge middlewares are still set the old non-composition way. This can be used next to the composition API:
<template>
<div />
</template>
<script setup lang="ts">
onMounted(() => {
useNuxtApp().nuxt2Context.$auth.login()
})
</script>
<script lang="ts">
export default {
middleware: ['auth'],
}
</script>