diff --git a/api/index.ts b/api/index.ts index 3cb5537..1aef67c 100644 --- a/api/index.ts +++ b/api/index.ts @@ -19,7 +19,7 @@ export default function(req: any, res: any, next: () => void) { .auth() .verifyIdToken(idToken) .then((decodedClaims: any) => { - res.locals.decodedClaims = decodedClaims; + res.locals.user = decodedClaims; }) .catch(() => { next(); diff --git a/nuxt.config.ts b/nuxt.config.ts index 942d2da..cab7bd1 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -83,30 +83,7 @@ const config: Configuration = { /* ** Nuxt.js modules */ - modules: [ - '@nuxtjs/axios', - '@nuxtjs/pwa', - '@nuxtjs/dotenv', - '@nuxtjs/firebase', - ], - - firebase: { - config: { - apiKey: 'AIzaSyBp95Odjc3I3WG7k4DGSSqb9LZC1FKExZQ', - authDomain: 'dashub-ecfb7.firebaseapp.com', - databaseURL: 'https://dashub-ecfb7.firebaseio.com', - projectId: 'dashub-ecfb7', - storageBucket: 'dashub-ecfb7.appspot.com', - messagingSenderId: '874351010489', - appId: '1:874351010489:web:e54fc45f23d51834923168', - measurementId: 'G-3F2M69JSHM', - }, - services: { - auth: { - ssr: true, - }, - }, - }, + modules: ['@nuxtjs/axios', '@nuxtjs/pwa', '@nuxtjs/dotenv'], serverMiddleware: ['~/api/index.ts'], diff --git a/package.json b/package.json index 6df2b45..5d88212 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,6 @@ "@nuxt/typescript-runtime": "0.4.6", "@nuxtjs/axios": "5.10.3", "@nuxtjs/dotenv": "1.4.1", - "@nuxtjs/firebase": "5.2.0", "@nuxtjs/pwa": "3.0.0-beta.20", "@vue/composition-api": "0.5.0", "firebase": "7.14.2", diff --git a/plugins/firebase.ts b/plugins/firebase.ts index 93e1cac..011d6a3 100644 --- a/plugins/firebase.ts +++ b/plugins/firebase.ts @@ -14,8 +14,11 @@ const firebaseConfig = { }; export const provideFirebase = () => { - if (!firebase.apps.some((app) => app?.name === 'client')) + if (firebase.apps.some((app) => app?.name === 'default')) { firebase.initializeApp(firebaseConfig, 'client'); + } else if (!firebase.apps.some((app) => app?.name === 'client')) { + firebase.initializeApp(firebaseConfig); + } }; export const useFirebaseAuth = () => { diff --git a/yarn.lock b/yarn.lock index f8bf4c5..2bc0971 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1746,15 +1746,6 @@ consola "^2.11.3" eslint-loader "^4.0.2" -"@nuxtjs/firebase@5.2.0": - version "5.2.0" - resolved "https://registry.yarnpkg.com/@nuxtjs/firebase/-/firebase-5.2.0.tgz#424c2196b2da288658148eb105dd152524d97f8d" - integrity sha512-utznHEJeoGej01YBgDbX5Elt1L/25aWj7O4aF/PzV7A1WCWi3sBLQDoqSdnIrDkyX/gr8xYrc/BOD024iwiAuA== - dependencies: - consola "^2.11.3" - optionalDependencies: - firebase-admin "^8.11.0" - "@nuxtjs/proxy@^1.3.3": version "1.3.3" resolved "https://registry.yarnpkg.com/@nuxtjs/proxy/-/proxy-1.3.3.tgz#3de3d9f073e8e57167168100940be2a824a220e0" @@ -5856,7 +5847,7 @@ find-versions@^3.2.0: dependencies: semver-regex "^2.0.0" -firebase-admin@8.12.1, firebase-admin@^8.11.0: +firebase-admin@8.12.1: version "8.12.1" resolved "https://registry.yarnpkg.com/firebase-admin/-/firebase-admin-8.12.1.tgz#a380c43a9e6ba37dfbe42211a253dd890a442063" integrity sha512-DZ4Q7QQJYaO2BhnhZLrhL+mGRTCLS5WrxjbJtuKGmbKRBepwMhx++EQA5yhnGnIXgDHnp5SrZnVKygNdXtH8BQ==