nuxt3-directus-starter
nuxt3-directus-starter copied to clipboard
API issue
Hi I struggle to make the API call in the ExamplesApiRoutes to work. the sayHello function doesnt work with a dynamic name.value using v-bind but it does with a static param (see bellow)
async function sayHello() {
const { data } = await useFetch('/api/hello', {
params: {
name: name.value,
//name: 'quentin', this works but name.value doesnt ?
},
})
response.value = data.value
loading.value = false
}
Maybe it comes from the useQuery in the hello.js file ?
const query = useQuery(event)
return {
message: `Hello ${query.name} 👋`,
}
})
Any idea ?
Let me test this
Check out this commit and see if that doesn't solve it for you https://github.com/bryantgillespie/nuxt3-directus-starter/commit/250328265d903bb4ae17628225f246d588bb68b0
Great, didnt know about the cache issue. Thx Q
Just a related question.
Let's say I have opened a slug page after fetching with the content compoment.
The if I reload the slug page I obtain an error 500
Cannot read property 'title' of null at processTicksAndRejections (internal/process/task_queues.js:95:5)
I dont get why we loose the property ?
Just a related question. Let's say I have opened a slug page after fetching with the content compoment. The if I reload the slug page I obtain an error 500
Cannot read property 'title' of null at processTicksAndRejections (internal/process/task_queues.js:95:5)I dont get why we loose the property ?
Looks like I need to do some updates. I think this is probably because I updated this to the latest RC
Found this on their documentation. https://v3.nuxtjs.org/bridge/bridge-composition-api#usemeta
Looks like useMeta is now deprecated.
Should probably be using the useHead composable instead.
useMeta({
title: page.value.title,
})
should be
useHead({
title: page.value.title,
})
I amended to useHead and I can read fine in Postman the GET request, but in the either Safari or Brave I get:
The database is already on AWS RDS but it shouldn't be the case It is public file and role but I am authenticated successfully and everything else is working.
The error you're seeing there is coming back from your Directus instance. So there's likely something wrong with your call to the Directus API or the permissions aren't set correctly on your Directus instance.
Looks like useMeta is now deprecated.
Should probably be using the useHead composable instead.
useMeta({ title: page.value.title, })should be
useHead({ title: page.value.title, })
It was indeed deprecated but I still have the same issue. I think its more related to the fetching method.
Error I have:
[Vue warn]: Unhandled error during execution of setup function
at <[slug] onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >
The error you're seeing there is coming back from your Directus instance. So there's likely something wrong with your call to the Directus API or the permissions aren't set correctly on your Directus instance.
I am using unmodified Docker Image on my localhost and set read permissions for Pages, Images and the next one right bellow. I also did not change the code on the call or any other part from your repository.
I am using unmodified Docker Image on my localhost and set read permissions for Pages, Images and the next one right bellow. I also did not change the code on the call or any other part from your repository.
Then it sounds like there may be an issue with the way I'm making the call to the API then.
I'll investigate further but will be a few days before I have time to dive into it.
I am using unmodified Docker Image on my localhost and set read permissions for Pages, Images and the next one right bellow. I also did not change the code on the call or any other part from your repository.
Then it sounds like there may be an issue with the way I'm making the call to the API then.
I'll investigate further but will be a few days before I have time to dive into it.
https://github.com/bryantgillespie/nuxt3-directus-starter/pull/24
:)