State change with logged in user

Hello Experts,

On my website, I have download buttons for digital products.

Here is what I wanted to implement.

Logged-in users can download files.
Others will be redirected to the signup page when clicked on the same download button.

Can you guys provide me with direction on implementing it?

Thank You,
Nuwan T.

  • Implement permissions on the frontend so that you can conditionally display the buttons
  • Implement permissions on the backend so that if users bypass the frontend in some way they still won’t be able to download the asset
1 Like

Hi @nuwanz
You can use store(vuex or pinia ) or js file to create a global variable that can be imported in components as a login variable. I have created a demo project for you, you can have a look on it : Vue router (forked) - CodeSandbox
Test email for signin:
password : test123

I hope this helps.

1 Like

Awesome. Thanks for your help Sir.

1 Like

Thanks James as always.