Skip to content
This repository was archived by the owner on Dec 15, 2023. It is now read-only.

Create more than one WPAPI instance (with different endpoints) #155

@lagset

Description

@lagset

Hey there,

I am using wp-nuxt to integrate a wordpress multisite-network (mutliple languages). So far it works great, however I am having a hard time figuring out whether or not it is possible to define multiple endpoints in the nuxt.config.js, like in the following example.

This is the standard way defining one WPAPI instance which can be referenced using this.$wp in vuex:
nuxt.config.js

...
  modules: [
    "wp-nuxt",
  ],
wp: {
    endpoint: "http://cmshost/wp-json/",
}
...

Now, I want to have a second (or more) WPAPI instance(s) providing a different endpoint. In my case the endpoint would vary by locale:

nuxt.config.js

...
  modules: [
    "wp-nuxt",
  ],
wp: {
    endpoint: ["http://cmshost/wp-json/", "http://cmshost/wp-json/de"],
}
...

Is this possible using wp-nuxt or do I need to change using node-wpapi directly and do the nuxt integration myself?

Thanks in advance,
Valentin

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions