【问题标题】:Strapi create cart on user creationStrapi 在用户创建时创建购物车
【发布时间】:2019-11-17 14:16:01
【问题描述】:

我是 Strapi 的新手,到目前为止我真的很喜欢无头 CMS。 按照教程,我用 node/express 和 next 构建了一个简单的类似 eCom 的网站。创建用户时,我会自动创建并分配购物车

// in the signup logic, once you created the newUser:
await new Cart({ user: newUser._id }).save();

我正在尝试对 Strapi 做同样的事情,但找不到方法。我尝试了像

这样的回调
before save

但无济于事。

有什么想法吗?

【问题讨论】:

    标签: javascript node.js next strapi


    【解决方案1】:

    您无权访问在 Strapi 生命周期中执行请求的用户 ID。

    这里是相关问题 - https://github.com/strapi/strapi/issues/1443

    【讨论】:

    • 谢谢吉姆,我明白了。我会尝试找到另一种方法将购物车与用户链接。
    • 我在 Spectrum 上回答了你的问题。
    • 感谢吉姆!未来参考:spectrum.chat/strapi/tips-tricks/…
    猜你喜欢
    • 2020-10-19
    • 1970-01-01
    • 2014-03-13
    • 1970-01-01
    • 2022-11-12
    • 1970-01-01
    • 2016-01-29
    • 2019-01-09
    • 1970-01-01
    相关资源
    最近更新 更多