Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API issue #12

Open
quentinglorieux opened this issue Nov 8, 2022 · 11 comments
Open

API issue #12

quentinglorieux opened this issue Nov 8, 2022 · 11 comments

Comments

@quentinglorieux
Copy link

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 ?

@bryantgillespie
Copy link
Owner

Let me test this

@bryantgillespie
Copy link
Owner

Check out this commit and see if that doesn't solve it for you
2503282

@quentinglorieux
Copy link
Author

Great, didnt know about the cache issue.
Thx
Q

@quentinglorieux
Copy link
Author

quentinglorieux commented Nov 13, 2022

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 ?

@bryantgillespie
Copy link
Owner

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,
})

@staminna
Copy link

staminna commented Nov 16, 2022

I amended to useHead and I can read fine in Postman the GET request, but in the either Safari or Brave I get:

Captura de ecrã 2022-11-16, às 23 52 46

Captura de ecrã 2022-11-16, às 23 57 40

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.

@bryantgillespie
Copy link
Owner

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.

@quentinglorieux
Copy link
Author

quentinglorieux commented Nov 17, 2022

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.

Screenshot 2022-11-17 at 16 40 46

Error I have:

[Vue warn]: Unhandled error during execution of setup function 
  at <[slug] onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > >

@staminna
Copy link

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.

@bryantgillespie
Copy link
Owner

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.

@BlackDahlia313
Copy link

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.

#24

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants