在Vue前端获取Magento 2客户ID

发布于 2025-02-07 06:39:57 字数 669 浏览 1 评论 0原文

我正在使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文