AlokaiA
Alokai2y ago
kantro

storefront-nuxt3-magento2 integration

I have installed in my local machine storefront-nuxt3-boilerplate and then implement a custom magento integration following the docs instruction.

After yarn dev I have this good feedback

web:dev: Nuxi 3.6.5
web:dev: Nuxt 3.6.5 with Nitro 2.5.2
server:dev: ℹ Middleware starting....
server:dev: ℹ Loading integrations...
server:dev: ℹ - Loading: magento @vue-storefront/magento-api/server
server:dev: ✔ - Integration: magento init function Start!
server:dev: ✔ - Integration: magento init function Done!
server:dev: ℹ - Loading: magento extension: tokenExtension
server:dev: ✔ - Integration: magento loaded!
server:dev: ✔ Integrations loaded!
server:dev: ✔ Middleware created!
server:dev: Middleware started: http://localhost:8181
web:dev: 
web:dev:   > Local:    http://localhost:3000/ 
web:dev:   > Network:  http://10.10.30.146:3000/
web:dev: 


So after I try to fetch some data, for example the categoryList.

So I put this code for the click of the button on BrowseProducts of TopNavigationBar.

const { data } = await useAsyncData(async () => await sdk.magento.categoryList({}))

const res = computed(() => data?.value?.data?.categories?.items?.[0]?.children)

function checkFetchDataFromMagento() {
  console.log('check fetch data from magento')
  console.log(res)
}


The problem is that with GET Request at the url
http://localhost:8181/magento/categoryList?body=[%7B%7D,null,null]
I get back 404, as you can see in the photo.

On the other hand, the same API Request with POST method, I get back exactly the data I need.

Could anyone explain this paradox and how I could solve it?
image.png
image.png
Was this page helpful?