Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"firebase": "^8.2.9",
"firebaseui": "^4.7.3",
"nuxt": "^2.15.2",
"vuexfire": "2.3.1"
"vuexfire": "^3.2.5"
},
"devDependencies": {
"@nuxtjs/eslint-config": "^5.0.0",
Expand Down
2 changes: 2 additions & 0 deletions plugins/firebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import firebaseConfig from '~/firebaseconfig'
import 'firebase/auth'
import 'firebase/database'
import 'firebase/functions'
import 'firebase/firestore'

if (!firebaseConfig) {
throw new Error('missing firebase.json config.')
Expand All @@ -13,6 +14,7 @@ if (!firebase.apps.length) {
}

export const db = firebase.database()
export const firestoreDb = firebase.firestore()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this variable as DB, this would be the name everyone will proceed with

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!


export default function ({ store }, inject) {
inject('firebase', firebase)
Expand Down
4 changes: 2 additions & 2 deletions store/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import firebase from 'firebase/app'
import 'firebase/database'
import 'firebase/auth'
import { firebaseMutations } from 'vuexfire'
import { vuexfireMutations } from 'vuexfire'

export const strict = false

Expand All @@ -17,7 +17,7 @@ export const mutations = {
setAdmin(state, admin) {
state.isAdmin = admin
},
...firebaseMutations
...vuexfireMutations
}

export const actions = {
Expand Down
10 changes: 5 additions & 5 deletions store/robocon.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { firebaseAction } from 'vuexfire'
import { db } from '@/plugins/firebase'
import { firestoreAction } from 'vuexfire'
import { firestoreDb } from '@/plugins/firebase'

const roboconRef = db.ref('robocon/current')
const roboconRef = firestoreDb.collection('robocon').doc('current')

export const state = () => ({
robocon: {}
})

export const actions = {
setRoboconRef: firebaseAction(({ bindFirebaseRef }) => {
return bindFirebaseRef('robocon', roboconRef)
setRoboconRef: firestoreAction(({ bindFirestoreRef }) => {
return bindFirestoreRef('robocon', roboconRef)
})
}
15 changes: 11 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2393,6 +2393,11 @@
resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.8.2.tgz#1fd24b99e417176566f8ada718fd16dbc7ef2b7a"
integrity sha512-7PRna6st1As9DBTXO3Lf1lYw7bi+b/6kE2OPjvvdWHLfBxTI01FW1HSqt4akYzKe1Cta3bmhuwct4OAF2EVemA==

"@posva/vuefire-core@^2.3.4":
version "2.3.4"
resolved "https://registry.yarnpkg.com/@posva/vuefire-core/-/vuefire-core-2.3.4.tgz#58a2561c957c982a9dea26a559c018756e30f035"
integrity sha512-jumUMMDBMDRtx9reIKCkC92TRwxJ/vG0+7iX2gQNXbS9cIVh4iI78PQm8e9ztCiBmdlALuBvfbcvDoD60cvJuw==

"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf"
Expand Down Expand Up @@ -17222,10 +17227,12 @@ vuex@^3.6.2:
resolved "https://registry.yarnpkg.com/vuex/-/vuex-3.6.2.tgz#236bc086a870c3ae79946f107f16de59d5895e71"
integrity sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==

[email protected]:
version "2.3.1"
resolved "https://registry.yarnpkg.com/vuexfire/-/vuexfire-2.3.1.tgz#9a3bd6cab06183f48dd864c401073688898643c2"
integrity sha512-DLlpCew+uDIhHpVKGHbpgOUBSJT6loK2EZmKWiVvz/m0hzw8hNPFLnx/MZwtitfX5zVaq59hD8b72/YA03oSsA==
vuexfire@^3.2.5:
version "3.2.5"
resolved "https://registry.yarnpkg.com/vuexfire/-/vuexfire-3.2.5.tgz#d176b655d6a103b5bcee19bdeeb8b3ec6eeff48b"
integrity sha512-fztRzKljqTjNmNexAzKkk7b9h/xrNu3e2hI05VZAT6/hRljRUJavxO5ATXZCXG4rQE3kNHODpMJG6BiR2T8u0g==
dependencies:
"@posva/vuefire-core" "^2.3.4"

w3c-hr-time@^1.0.2:
version "1.0.2"
Expand Down