Shopware PWA custom route

229 views Asked by At

I've create a custom Store route inside Shopware 6 as a plugin. It shows up in the store-api/_info/swagger.html url.

What is does is it return an array with static text for now.

Now is my question, how would i call this url inside the pwa with vuestorefront. I created a page inside src/pages but i cant wrap my mind around how to call the url to ge the data.

Do i need to specify the whole url in the axios? I cant find any documentation about this.

Thanks in advance!

1

There are 1 answers

0
Dominic Klein On

You approach so far is correct.

  1. Create a new Store API route to fetch data from Shopware
  2. Create a new Nuxt page by creating a page in src/pages.

Now we only need to connect the dots.

Nuxt pages are simply Vue components, so you can use the invokePost or invokeGet methods from the shopware-6-client package to call your custom endpoint.

You could also use axios to do it, but then you'll need to handle additional parameters (e.g. passing the correct sw-context-token or sw-access-key manually.