@tryghost/content-api / Nuxt 3

I followed this tutorial:
https://ghost.org/docs/jamstack/nuxt/

It only works when I set ssr = false in the nuxt.config.ts
or use <ClientOnly><h1>{{ post.title }}</h1><ClientOnly>

If not, there an error message from AXIOS:

There is no suitable adapter to dispatch the request since :
- adapter xhr is not supported by the environment
- adapter http is not available in the build

Why does the GhostContentAPI only work on the client side?

I have discovered similar error messages
tryghost-content-api-is-not-working-on-next-v14
i-cant-use-local-ghost-content-api
But is not for NUXT.

Thanks for help, Joe

I have found a solution - using fetch instead of axios:
alyatwa, thank you.

The solution didn’t work perfect:

await ghostApi.pages
        .browse({
            limit: "all",
            include: "tags,authors"   <----- don't work
        })

You have to remove encodeURIComponent:

 makeRequest: ({url, method, params, headers}) => {
        const apiUrl = new URL(url);
        Object.keys(params).map((key) =>
            // apiUrl.searchParams.set(key, encodeURIComponent(params[key]))
            apiUrl.searchParams.set(key, params[key])
        );
 ...

And then it works :slight_smile: