在Vue前端获取Magento 2客户ID
我正在使用Vue Storefront(带有Express.js的NUXT.JS),其中GraphQl查询用于从Magento 2获取数据。
我尝试在GraphQl查询中添加客户ID以获取客户数据,但它返回为null(请参阅下面的响应)。我已经阅读了这一点,不建议使用客户ID在客户中尝试一些东西。
"data":{
"customer":{
"__typename":"Customer",
"date_of_birth":null,
"email":"[email protected]",
"firstname":"john",
"is_subscribed":false,
"id":null,
"addresses":[
...
除了安全风险,我如何在我的前端中保持客户ID?我可以作为JavaScript函数执行一个小的GraphQl查询吗?我也有一个应用程序的Express.js部分,可以在其中安全请求并将数据发送到其他平台(这是服务器端)。
I am working on Vue Storefront ( a Nuxt.js with Express.js based framework) where GraphQL queries are used to get data from Magento 2.
I tried to add customers ID in the GraphQL query for customer data but it returned as Null (see response below). I've read this is not recommended but I still want to try something in my client with the Customer ID.
"data":{
"customer":{
"__typename":"Customer",
"date_of_birth":null,
"email":"[email protected]",
"firstname":"john",
"is_subscribed":false,
"id":null,
"addresses":[
...
How can I, safety risks aside, still aquire the Customer ID in my front-end? Is there a small GraphQl query I can execute as a javascript function? I also have an Express.js part of my app where I can securely request and send data to other platforms (this is server side).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论