gpt4 book ai didi

javascript - Ember-DS queryRecord 返回 TypeError : Cannot convert undefined or null to object

转载 作者:行者123 更新时间:2023-12-03 05:09:29 25 4
gpt4 key购买 nike

我正在尝试在我的 model 函数内进行 queryRecord 搜索,但似乎遇到了错误:

类型错误:无法将未定义或 null 转换为对象

我的 model() 如下所示:

model() {
return this.store.queryRecord('model', { property: 'value' })
.then(doc => console.log(doc)) // This doesn't even invoke
}

最佳答案

此错误的原因是 XHRREST API 返回 nullundefined 作为响应而不是空的对象数组

> GET /model?query=x
< null

应该是

> GET /model?query=x
< {}

关于javascript - Ember-DS queryRecord 返回 TypeError : Cannot convert undefined or null to object,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41881760/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com