簡體   English   中英

Firebase 版本:-未捕獲(承諾)FirebaseError:預期類型為“Xc”,但它是:自定義 Zc object

[英]Firebase Version :-Uncaught (in promise) FirebaseError: Expected type 'Xc', but it was: a custom Zc object

   const handleSubmit = async (event) => {
    event.preventDefault();
    let x = Math.floor((Math.random() * 100000000) + 1);

    const data = {
        timestamp: Timestamp.now().seconds,
        uid: `${currentUser.uid}+${x}`,
        email: currentUser.email,
        fromDate: fromDate,
        toDate: toDate,
        city: city,
        para: para,
        totalexpense: TotalExpense,
        itinerary: itinerary
    }
    console.log(data)

    await setDoc(collectionGroup(db, "experiences", currentUser.email, currentUser.email), {...data}) // error

}

我正在從表單中獲取輸入並希望將數據作為 firebase V9 中的集合發送,但是當我提交數據時顯示上述錯誤

setDoc()DocumentReference作為參數。 嘗試:

const docRef = doc(db, "experiences", currentUser.email);

await setDoc(docRef, {...data}) 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM