Many fixes n stuff

This commit is contained in:
mcarquigny
2025-03-20 16:47:26 +01:00
parent 12086a4c88
commit 56a251b929
5 changed files with 106 additions and 68 deletions

View File

@ -27,6 +27,11 @@ export async function loadAppData (store) {
// })
// }
//
export function addToCollection (store, data) {
return pb.collection(data.collection).create(data.data)
}
// export function removeFromCollection (store, data) {
// return Firebase.database().ref('/' + data.collection).once('value').then((snapshot) => {
// let index = snapshot.val().findIndex(item =>
@ -35,15 +40,26 @@ export async function loadAppData (store) {
// return Firebase.database().ref('/' + data.collection + '/' + index).remove()
// })
// }
export function removeFromCollection (store, data) {
return pb.collection(data.collection).delete(data.data.id)
}
//
// export function updateItem (store, data) {
// return Firebase.database().ref(`/${data.collection}/${data.itemId}`).set(data.data)
// }
//
export function updateItem (store, data) {
return pb.collection(data.collection).update(data.data.id, data.data)
}
// export function deleteItem (store, data) {
// return Firebase.database().ref(`/${data.collection}/${data.itemId}`).set(null)
// }
//
export function deleteItem (store, data) {
return pb.collection(data.collection).delete(data.data.id)
}
// export function uploadFile (store, file) {
// return Firebase.storage().ref().child(Date.now() + file.name).put(file)
// }