Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | /* export function someAction (context) { } */ import firebase from "firebase/app"; import "firebase/auth"; import "firebase/database"; import { firebaseAction } from "vuexfire"; export const setProjectsRef = firebaseAction( ({ bindFirebaseRef, commit }, ref) => { return bindFirebaseRef("projects", ref); } ); export const setCategoryRef = firebaseAction( ({ bindFirebaseRef, commit }, ref) => { return bindFirebaseRef("category", ref); } ); export const setLatestProjectsRef = firebaseAction( ({ bindFirebaseRef, commit }, ref) => { return bindFirebaseRef("latestProjects", ref); } ); export function loadAllProjects({ state, dispatch }) { const db = firebase.database(); var ref = db .ref("library/projects") .orderByKey() .limitToFirst(state.limit); dispatch("setProjectsRef", ref); } export function loadCategory({ state, dispatch }, category_id) { const db = firebase.database(); var projects_ref = db .ref("library/projects") .orderByChild("category") .equalTo(category_id) .limitToFirst(state.limit); var cat_ref = db.ref("library/categories/" + category_id); dispatch("setProjectsRef", projects_ref); dispatch("setCategoryRef", cat_ref); } export const loadLatestProjects = firebaseAction(({ bindFirebaseRef }) => { const db = firebase.database(); const ref = db .ref("library/projects") .orderByKey() .limitToFirst(6); return bindFirebaseRef("latestProjects", ref); }); export const loadFeaturedProjects = firebaseAction(({ bindFirebaseRef }) => { const db = firebase.database(); const ref = db .ref("library/projects") .orderByKey() .limitToFirst(6); return bindFirebaseRef("featuredProjects", ref); // dispatch("setFeaturedProjectsRef", ref); }); |