akie
AAlokai
•Created by akie on 10/30/2023 in #🙋|general-help
How to extend getHeaders in @vue-storefront/magento-api
hi,everyone~
I'm currently using the
@vue-storefront/magento-api
repository, and I've noticed that each API uses the getHeaders method to set headers. However, the getHeaders
method only reads three items: Content-Currency, store, and Authorization
.
I've noticed that each request can be configured with the customHeaders
parameter, but that's not what I'm looking for.
I'm looking for a way to configure or override it ( getHeaders
) to set more parameters. (Global)or set GLOBAL customHeaders?
Where can I configure or override this? Thank you very much for your assistance.
@rohrig & @skirianov thanks~3 replies
AAlokai
•Created by akie on 10/13/2023 in #🙋|general-help
About add custom request headers
Hello guys,👋
In our project, we plan to add a global custom header to the request header sent to magento.
and we are using
magento-api
, which uses apollo-client
, and use get header to setcontent-currency & store
I know that fixed request headers can be set in middleware.config.js, for example:
customApolloHttpLinkOptions: {
useGETForQueries: true,
headers: {
'custom-header': 'custom-header-value',
'client-secret': 'xxxxxxxxx'
},
},
, But how to set dynamic global request
We tried adding a global custom request header context in the middleware, but when going through Apollo, it was converted into a get request, and the relevant header did not exist
so How should I add a global custom request header? maybe i need a help
thanks.🤝20 replies
AAlokai
•Created by akie on 8/23/2023 in #🙋|general-help
General question about get cmsblock in cmsPage
Hey gusys!
Hello everyone!
As we are aware, Magento supports nested blocks in CmsPage to dynamically load both dynamic and static content, or even CmsBlock.
Is there any way to achieve a similar requirement at present? Or is it the case that this approach isn't supported after the frontend and backend are decoupled?
I'm also interested in understanding the general approach for this. For instance, is there a method to request a related cmsBlock to assemble the page according to the specific URL?
I believe there might be a commonly used implementation for this.
I'm looking for a standard and straightforward solution(common practice), so any assistance would be greatly appreciated. Thank you!🤝
3 replies
AAlokai
•Created by akie on 5/31/2023 in #🙋|general-help
About request log from middleware to magento
hi everyone
I hope this message finds you well. I am reaching out today to ask for some guidance regarding a challenge I'm facing. Specifically, I need to inspect the requests (including headers) sent from Nuxt(is middleware) to Magento, and I'm not quite sure about the best way to accomplish this.
I've attempted to log requests in plugins and middleware. While this did give me some request records, it seems that those are only requests made between the browser and the middleware, which isn't seem exactly what I need.
I also tried to intercept requests after creating an
Axios interceptors.request
after const client = axios.create(config.axios)
However, this didn't provide me with any different results.
I noticed that @vue-storefront/magento-api
imports Apollo, but after checking the corresponding config files in the project, I still didn't find the information I was looking for.
My goal is to obtain the actual requests made to the Magento endpoint, such as https://localhost:3001/graphql?query=query+getStoresAndCurrencies%7BavailableStores%7Bstore_code+__typename%7Dcurrency%7Bavailable_currency_codes+__typename%7D%7D&operationName=getStoresAndCurrencies&variables=%7B%7D and inspect the associated headers.
Could you please provide some guidance on how to achieve this? Any help would be greatly appreciated. Thank you for your time and consideration.
Best regards,
acacius6 replies