Page traduite Le contenu de cette page peut être déprécié.
Middleware nommé
Utiliser un middleware nommé pour authentifier un utilisateur utilisant le store et lui permettre de visiter une page une fois authentifié.
Dans cet exemple :
pages/named-middleware.vue
contient une propriété middleware
avec la valeur auth
qui est appelée avant qu'un utilisateur n'entre dans la route.
middleware/auth.js
vérifie si l'utilisateur est authentifié et s'il ne l'est pas, le redirige vers la page d'authentification.
pages/auth.vue
utilise le store pour authentifier l'utilisateur.
store/auth.js
définit les valeurs de l'utilisateur et du mot de passe et redirige l'utilisateur.
En savoir plus dans le chapitre middleware .
Loading Sandbox...
Editer cette page sur GitHub
Mise à jour le jeu. 9 février 2023

























































