dimanche 24 juin 2018

Access the Laravel session in my Vue Component

For the context, I send an email for the verification of the account of my user. By clicking on a button, it triggers a /verify-user route on my laravel routes. At the end of my activation action into my controller, I make a return redirect('/')->with('message', 'Your account has been activated');.

According to the documentation this line put my message into the session.

But now I want to access this session into my .vue component when the component is mounted. I tried to use the vue-session package, but that returns me always "undefined" when I try to access the this.$session.get('message').

My '/' component is composed with an app.blade.php where I have a router-view component who render the component based on my vue routes.

I am quite sure I am not the first person who want to do something like this, but I don't find any clue on the internet how to do that.

I tried with the props but in vain :(

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire