Basic UI rework
This commit is contained in:
49
src/store/core/actions.js
Normal file
49
src/store/core/actions.js
Normal file
@ -0,0 +1,49 @@
|
||||
import { pb } from 'src/boot/pocketbase'
|
||||
//
|
||||
// export function loadAppData (store) {
|
||||
// return Firebase.database().ref().once('value').then((snapshot) => {
|
||||
// store.commit('setFirebaseState', snapshot.val())
|
||||
// })
|
||||
// }
|
||||
//
|
||||
export async function loadAppData (store) {
|
||||
return Promise.all([
|
||||
pb.collection('stock').getFullList(),
|
||||
pb.collection('history').getFullList(),
|
||||
pb.collection('categories').getFullList()
|
||||
]).then(([stock, history, categories]) => {
|
||||
return store.commit('setFirebaseState', {
|
||||
stock,
|
||||
history,
|
||||
categories
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// export function addToCollection (store, data) {
|
||||
// return Firebase.database().ref('/' + data.collection).once('value').then((snapshot) => {
|
||||
// let index = parseInt(Object.keys(snapshot.val()).reverse()[0]) + 1
|
||||
// return Firebase.database().ref('/' + data.collection + '/' + index).set(data.data)
|
||||
// })
|
||||
// }
|
||||
//
|
||||
// export function removeFromCollection (store, data) {
|
||||
// return Firebase.database().ref('/' + data.collection).once('value').then((snapshot) => {
|
||||
// let index = snapshot.val().findIndex(item =>
|
||||
// item.timestamp === data.data.timestamp && item.ref === data.data.ref
|
||||
// )
|
||||
// return Firebase.database().ref('/' + data.collection + '/' + index).remove()
|
||||
// })
|
||||
// }
|
||||
//
|
||||
// export function updateItem (store, data) {
|
||||
// return Firebase.database().ref(`/${data.collection}/${data.itemId}`).set(data.data)
|
||||
// }
|
||||
//
|
||||
// export function deleteItem (store, data) {
|
||||
// return Firebase.database().ref(`/${data.collection}/${data.itemId}`).set(null)
|
||||
// }
|
||||
//
|
||||
// export function uploadFile (store, file) {
|
||||
// return Firebase.storage().ref().child(Date.now() + file.name).put(file)
|
||||
// }
|
Reference in New Issue
Block a user