How to use different page (.vue) files for a Nuxt route depending on the client / server?

Hi everyone, I have a route for my products at '/product/[id]' and I want to implement a feature where if a user clicks on a product from the product listing, it should open in a modal (ProductModalPage.vue). However, if the user comes directly to the route from Google or types it into their browser, it should use another page file (ProductDirectPage.vue). I want to achieve this by checking if the process is running on the client or the server side. If it is running on the client, I want to use ProductModalPage.vue, and if it is running on the server, I want to use ProductDirectPage.vue. Shortened: Route: '/product/[id]' if (process.client) -> use "ProductModalPage.vue" // Maybe a nuxt child over the listing? if (process.server) -> use "ProductDirectPage.vue" Can you please suggest the best way to achieve this using Nuxt? Thank you!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server