I have a Vue application and when a user visits a specific page, I want to auto-redirect to an external page. I am not sure how to do that.
For example:
http://localhost:3000/redirecting/?link=http://externalsite.com
- I know how to read the link parameter from the URL. So, I'll get this.
- Then I have user auth data in state and I can get it in computed properties.
- Now, based on the user object I can determine if the user is logged in or not.
- If he is not logged in, redirect to the login page. If user is logged in, redirect to the external link (This is the problem area).
Note that there is no click or anything. As soon as a user visits this page, the redirect should happen. Even better if we can show a message 'Redirecting...' for a second.
Update: I am using Nuxt/Vue.