[Vuejs]-Vue Nuxt Auth enable auth middleware per route using Class Components

3👍

You need to add it as a param in the Component decorator.


<script lang="ts">
import { Component, Vue } from 'nuxt-property-decorator';

@Component({
  middleware: ['auth']
})
export default class Profile extends Vue {
  name = 'some data'
}
</script>

What you did initially will only create a data property. To add component specific option aside from Vue options like data computed methods and hooks you have to pass it as a param in the @Component decorator

Read more about it here

Leave a comment