nuxt-community / firebase-module

🔥 Easily integrate Firebase into your Nuxt project. 🔥
https://firebase.nuxtjs.org
MIT License
640 stars 98 forks source link

Inject main firebase app #334

Closed rolandszpond closed 3 years ago

rolandszpond commented 3 years ago

This would allow for multiple buckets

var storage = this.$fireApp.storage("gs://my-custom-bucket")

lupas commented 3 years ago

@rolandszpond Thanks for the PR - I appreciate it!

We'll be injecting the firebase module with the coming restructuring in v7.0 (see PR https://github.com/nuxt-community/firebase-module/pull/258) as $fireModule anyway, so I won't be merging this since the code is already written in the mentioned PR which is currently in testing phase.

Now with the current version 6, wouldn't this.$fireStorageObj("gs://my-custom-bucket") work for your purposes?

rolandszpond commented 3 years ago

@lupas It wasn't working before when I tried that. I've upgraded to v7 and tried both this.$fire.storage('gs://my-custom-bucket) and this.$fireModule.storage('gs://my-custom-bucket') and I get the following errors:

while using this.$fire.storage('gs://my-custom-bucket')

this.$fire.storage is not a function

while using this.$fireModule.storage('gs://my-custom-bucket')

Firebase: firebase.storage() takes either no argument or a Firebase App instance. (app/invalid-app-argument).

rolandszpond commented 3 years ago

@lupas Figured it out using: this.$fireModule.app().storage('gs://my-custom-bucket')

lupas commented 3 years ago

Hey @rolandszpond

Great to hear and thanks again for the PR anyway!

I'll keep in my head (resp. in issue https://github.com/nuxt-community/firebase-module/issues/261) to someday implement an easy way to create multiple buckets as a built-in feature.