parent
0dba15b34e
commit
e627a7e5d8
8 changed files with 1888 additions and 30 deletions
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,35 @@ |
||||
import { initializeApp } from "firebase/app"; |
||||
import { getFirestore, doc, setDoc } from "firebase/firestore"; |
||||
|
||||
|
||||
const firebaseConfig = { |
||||
apiKey: "AIzaSyD1VzUKXt0JskwyfjfIAbdROzPNB3fTIw0", |
||||
authDomain: "uc-24070-thegreattipsy.firebaseapp.com", |
||||
projectId: "uc-24070-thegreattipsy", |
||||
storageBucket: "uc-24070-thegreattipsy.firebasestorage.app", |
||||
messagingSenderId: "772804793020", |
||||
appId: "1:772804793020:web:258003100900c20e0fb6b9", |
||||
measurementId: "G-1CRHMJY4L9" |
||||
}; |
||||
|
||||
const CollectionName="records"; |
||||
|
||||
// Initialize Firebase
|
||||
const app = initializeApp(firebaseConfig); |
||||
|
||||
export async function updateUser(id, data){ |
||||
if(!id || !data) { |
||||
console.error("Invalid id or data for updateUser"); |
||||
return; |
||||
}
|
||||
try{ |
||||
const db = getFirestore(app); |
||||
await setDoc(doc(db, CollectionName, id), data); |
||||
|
||||
console.log("Document successfully written!");
|
||||
|
||||
}catch(error){ |
||||
console.error("Error writing document: ", error); |
||||
}; |
||||
|
||||
} |
||||
Loading…
Reference in new issue