Beusebiu
Beusebiu

Reputation: 1523

Access session data from Vuejs

I try to access data from session, but I don't get anything.

In Controller I use: session()->get('cas_user') ?? ""; , and I get some date.

In Vuejs I try this: this.$session.get('cas_user') , and I don't get anything. Also this.$session.exists() is false.

I have vue-session.

Upvotes: 1

Views: 18570

Answers (1)

MedaiP90
MedaiP90

Reputation: 302

Have you initialized a session before accessing its values (that is why this.$session.exists() returns false)?

this.$session.start()

Have you saved something inside the 'cas_user' key before trying to get it?

this.$session.set('cas_user', value)

You can also try this.$session.getAll() to see if ther is some data saved in the session.

Upvotes: 1

Related Questions