[Vuejs]-Dynamic routes based on request to other app

1👍

What doesn’t work in your setup? Imagine you can check data.page before changing route:

<template>
  <NuxtPage />
</template>

<script setup>
// here some shortened logic

const router = useRouter()
const route = useRoute().fullPath;

try {
  const data = new RequestToBe(route).send();
  console.log(data) // { page: 'post', ... }
  if (data.page === 'post') {
    // go to post page
    router.push('/post')
  } else {
    // or do something else
  }
} catch (error) {
  // something went wrong
  console.log(error)
}
</script>
👤jjj

Leave a comment