1

I am currently working in a laravel vue app. I want to get logged in user's is in my main js file.How can I do this?

This method is not working:

This is my main HTML or blade files head tag code

<meta name="user_id" content="{{Auth::check() ? Auth::user()->id:'0'}}">

Tried to get this in my main.js file like this:

let userId=document.head.querySelector('meta[name="user_id"').content;
Pashupati Sah
  • 426
  • 5
  • 9

0 Answers0