![](/img/trans.png)
[英]is there a way to connect to sanity.io database / datastore data from Metabase?
[英]Sanity CMS: Get current user from datastore
我正在嘗試在 Sanity CMS 中獲取當前用戶。
我發現這個代碼片段演示了userStore 的使用
但我不明白如何配置我的項目以接受此模塊查找
import userStore from 'part:@sanity/base/user';
它引發導入錯誤Cannot find module 'part:@sanity/base/user'
。 作為非標准節點模塊,這是有道理的。
檢查那個@sanity
源我可以看到base/lib/datastores
有一個userStore
它只是不明顯如何使用它。
所以這個示例鈎子工作並返回用戶。 Sanity 正在處理模塊分辨率。 這是 IDE 錯誤,而不是 Sanity 中的運行時錯誤。
(╯°□°)╯︵ ┻━┻
他們的建議是忽略這些未解決的部件導入模塊警告。
"eslintConfig": {
"rules": {
"import/no-unresolved": [2, { "ignore": ["^(all|part):"] }]
}
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.