Nuxt x Firebase Cloud Functions
import firebase from 'firebase/app' | |
export default async (ctx, inject) => { | |
const options = { | |
'functionsLocation': 'asia-northeast1', | |
'config': { | |
'apiKey': 'xxxx', | |
'authDomain': 'xxxx', | |
'databaseURL': 'xxxx', | |
'projectId': 'xxxx', | |
'storageBucket': '', | |
'messagingSenderId': 'xxxx', | |
'appId': 'xxxx', | |
'measurementId': 'xxxx' | |
} | |
} | |
if (!firebase.apps.length) { | |
firebase.initializeApp(options.config) | |
} | |
await import('firebase/functions') | |
const fireFunc = firebase.app().functions(options.functionsLocation) | |
const fireFuncObj = firebase.functions | |
inject('fireFunc', fireFunc) | |
inject('fireFuncObj', fireFuncObj) | |
} | |
/* | |
** 参考 | |
** https://github.com/lupas/nuxt-fire | |
** MIT - 2018-present Pascal Luther | |
*/ |
export default { | |
// 色々略 | |
plugins: [ | |
'~/plugins/fireFunc.js' | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment