Heroku/Nuxt没有注意到混音?
我有一个按钮,可以重新指向条带签出页面-在我的本地机器上工作正常,但当我在生产中试用时,我在heroku日志中收到了这个错误:Heroku/Nuxt没有注意到混音?,heroku,stripe-payments,nuxt.js,Heroku,Stripe Payments,Nuxt.js,我有一个按钮,可以重新指向条带签出页面-在我的本地机器上工作正常,但当我在生产中试用时,我在heroku日志中收到了这个错误: 2021-04-07T14:22:30.664437+00:00 app[web.1]: 2021-04-07T14:22:30.664454+00:00 app[web.1]: ERROR Cannot read property 'subscriptions' of null 2021-04-07T14:22:30.664454+00:00 app[web.1]:
2021-04-07T14:22:30.664437+00:00 app[web.1]:
2021-04-07T14:22:30.664454+00:00 app[web.1]: ERROR Cannot read property 'subscriptions' of null
2021-04-07T14:22:30.664454+00:00 app[web.1]:
2021-04-07T14:22:30.664455+00:00 app[web.1]: at a.checkActiveSubscription (mixins/stripeSubscription.js:10:0)
2021-04-07T14:22:30.664455+00:00 app[web.1]: at a.hasAnyActiveSubscription (pages/profile/billing/index.vue:186:0)
2021-04-07T14:22:30.664456+00:00 app[web.1]: at a.hasAnyActiveSubscription (node_modules/vue/dist/vue.runtime.common.prod.js:6:29698)
2021-04-07T14:22:30.664457+00:00 app[web.1]: at a.render (pages/profile/billing/index.vue)
2021-04-07T14:22:30.664457+00:00 app[web.1]: at a.t._render (node_modules/vue/dist/vue.runtime.common.prod.js:6:35273)
2021-04-07T14:22:30.664458+00:00 app[web.1]: at node_modules/vue-server-renderer/build.prod.js:1:70637
2021-04-07T14:22:30.664458+00:00 app[web.1]: at Yi (node_modules/vue-server-renderer/build.prod.js:1:67201)
2021-04-07T14:22:30.664458+00:00 app[web.1]: at io (node_modules/vue-server-renderer/build.prod.js:1:70613)
2021-04-07T14:22:30.664458+00:00 app[web.1]: at ro (node_modules/vue-server-renderer/build.prod.js:1:70244)
2021-04-07T14:22:30.664459+00:00 app[web.1]: at eo (node_modules/vue-server-renderer/build.prod.js:1:67491)
2021-04-07T14:22:30.664459+00:00 app[web.1]:
Index.vue:
import checkActiveSubscription from "@/mixins/stripeSubscription.js";
export default {
mixins: [checkActiveSubscription],
....
}
computed: {
hasAnyActiveSubscription() {
return this.checkActiveSubscription();
},
stripeSubscription.js:
export default {
methods: {
checkActiveSubscription() {
/*
check if user has any active subscription
if so, the user should be able to manage their existing billing
else - show buttons to create new subscription plans
*/
let subscriptions = this.$store.getters.user.subscriptions;
let hasActiveSubscription = false;
subscriptions.some((element, index) => {
if (element.status == "active") {
hasActiveSubscription = true;
}
});
return hasActiveSubscription;
},
}
}
有什么建议吗?问题是关于Nuxt、Stripe还是Heroku
My Nuxt store看起来像这样(user.js位于名为store的文件夹中):
并将用户提取到计算属性中,如下所示:
user() {
return this.$store.getters.user;
},
从错误消息中,似乎
this.$store.getters.user
为空-设置在哪里?我将更新我的帖子
user() {
return this.$store.getters.user;
},