From 69a6207a4d53f35968c8d4fbd7a6ff820f36158a Mon Sep 17 00:00:00 2001 From: Andrew Bastin Date: Thu, 4 Nov 2021 18:33:21 +0530 Subject: [PATCH] refactor: move firebase initialization to a plugin --- packages/hoppscotch-app/layouts/default.vue | 2 -- packages/hoppscotch-app/nuxt.config.js | 1 + packages/hoppscotch-app/plugins/init-fb.ts | 3 +++ 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 packages/hoppscotch-app/plugins/init-fb.ts diff --git a/packages/hoppscotch-app/layouts/default.vue b/packages/hoppscotch-app/layouts/default.vue index e016db453..a0ca232bd 100644 --- a/packages/hoppscotch-app/layouts/default.vue +++ b/packages/hoppscotch-app/layouts/default.vue @@ -52,7 +52,6 @@ import { setupLocalPersistence } from "~/newstore/localpersistence" import { performMigrations } from "~/helpers/migrations" import { initUserInfo } from "~/helpers/teams/BackendUserInfo" import { registerApolloAuthUpdate } from "~/helpers/apollo" -import { initializeFirebase } from "~/helpers/fb" import { useSetting } from "~/newstore/settings" import { logPageView } from "~/helpers/fb/analytics" import { hookKeybindingsListener } from "~/helpers/keybindings" @@ -189,7 +188,6 @@ export default defineComponent({ }) } - initializeFirebase() initUserInfo() logPageView(this.$router.currentRoute.fullPath) diff --git a/packages/hoppscotch-app/nuxt.config.js b/packages/hoppscotch-app/nuxt.config.js index 8b6e44ae1..fe6c1b08f 100644 --- a/packages/hoppscotch-app/nuxt.config.js +++ b/packages/hoppscotch-app/nuxt.config.js @@ -100,6 +100,7 @@ export default { "~/plugins/v-focus", "~/plugins/v-textarea", "~/plugins/vue-apollo", + "~/plugins/init-fb.ts", "~/plugins/crisp", { src: "~/plugins/web-worker", ssr: false }, ], diff --git a/packages/hoppscotch-app/plugins/init-fb.ts b/packages/hoppscotch-app/plugins/init-fb.ts new file mode 100644 index 000000000..7bbb6ff4c --- /dev/null +++ b/packages/hoppscotch-app/plugins/init-fb.ts @@ -0,0 +1,3 @@ +import { initializeFirebase } from "~/helpers/fb" + +initializeFirebase()