1

I build a SPA with Craft CMS and Vue. I use Vue Router and have three Props. Here is my current router-view:

<router-view 
  csrfName="{{craft.app.config.general.csrfTokenName}}"
  csrfToken="{{craft.app.request.csrfToken}}"
  userID="{{currentUser.id}}"
/>

I build a user form which works perfect, but it would be great to get the loggedIn userID in the response or via GraphQL. With GraphQL we would have the advantage to check on every site if the user is still signed in

My log-in template looks the same like above but without the UserID. At the moment I make a hard redirect to my application with the userID because I can't get the data from GraphQL. That means I need to reload the whole page just to get the loggedIn userID. This isn't best practice.

Have someone a idea how I could solve this?

1

with a get request from /index.php?p=admin/actions/users/session-info&dontExtendSession=1 I can get my CSRF Code + the User ID. Great.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.