-
-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add firebase remote config service #49
Changes from 2 commits
f6523d6
301bb4e
c636ddc
08ebdfb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ export default async (ctx, inject) => { | |
} | ||
|
||
if (options.useOnly.includes('auth')) { | ||
<%= options.useOnly.includes('auth') ? "await import('firebase/auth')" : "" %> | ||
await import('firebase/auth') | ||
|
||
const fireAuth = firebase.auth() | ||
const fireAuthObj = firebase.auth | ||
|
@@ -19,7 +19,7 @@ export default async (ctx, inject) => { | |
} | ||
|
||
if (options.useOnly.includes('realtimeDb')) { | ||
<%= options.useOnly.includes('realtimeDb') ? "await import('firebase/database')" : "" %> | ||
await import('firebase/database') | ||
|
||
const fireDb = firebase.database() | ||
const fireDbObj = firebase.database | ||
|
@@ -28,7 +28,7 @@ export default async (ctx, inject) => { | |
} | ||
|
||
if (options.useOnly.includes('firestore')) { | ||
<%= options.useOnly.includes('firestore') ? "await import('firebase/firestore')" : "" %> | ||
await import('firebase/firestore') | ||
|
||
const fireStore = firebase.firestore() | ||
const fireStoreObj = firebase.firestore | ||
|
@@ -37,7 +37,7 @@ export default async (ctx, inject) => { | |
} | ||
|
||
if (options.useOnly.includes('storage')) { | ||
<%= options.useOnly.includes('storage') ? "await import('firebase/storage')" : "" %> | ||
await import('firebase/storage') | ||
|
||
const fireStorage = firebase.storage() | ||
const fireStorageObj = firebase.storage | ||
|
@@ -46,7 +46,7 @@ export default async (ctx, inject) => { | |
} | ||
|
||
if (options.useOnly.includes('functions')) { | ||
<%= options.useOnly.includes('functions') ? "await import('firebase/functions')" : "" %> | ||
await import('firebase/functions') | ||
|
||
const fireFunc = firebase.app().functions(options.functionsLocation) | ||
const fireFuncObj = firebase.functions | ||
|
@@ -56,7 +56,7 @@ export default async (ctx, inject) => { | |
|
||
// Firebase Messaging can only be initiated on client side | ||
if (process.browser && options.useOnly.includes('messaging')) { | ||
<%= options.useOnly.includes('messaging') ? "await import('firebase/messaging')" : "" %> | ||
await import('firebase/messaging') | ||
|
||
if (firebase.messaging.isSupported()) { | ||
const fireMess = firebase.messaging() | ||
|
@@ -68,7 +68,7 @@ export default async (ctx, inject) => { | |
|
||
// Firebase Performance can only be initiated on client side | ||
if(process.browser && options.useOnly.includes('performance')){ | ||
<%= options.useOnly.includes('performance') ? "await import('firebase/performance')" : "" %> | ||
await import('firebase/performance') | ||
|
||
const firePerf = firebase.performance() | ||
const firePerfObj = firebase.performance | ||
|
@@ -78,11 +78,21 @@ export default async (ctx, inject) => { | |
|
||
// Firebase Analytics can only be initiated on the client side | ||
if(process.browser && options.useOnly.includes('analytics')) { | ||
<%= options.useOnly.includes('analytics') ? "await import('firebase/analytics')" : "" %> | ||
await import('firebase/analytics') | ||
|
||
const fireAnalytics = firebase.analytics() | ||
const fireAnalyticsObj = firebase.analytics | ||
inject('fireAnalytics', fireAnalytics) | ||
inject('fireAnalyticsObj', fireAnalyticsObj) | ||
} | ||
|
||
// Firebase Remote Config can only be initiated on the client side | ||
if(process.browser && options.useOnly.includes('remoteConfig')) { | ||
await import('firebase/remote-config') | ||
|
||
const fireConfig = firebase.remoteConfig() | ||
const fireConfigObj = firebase.remoteConfig | ||
inject('fireConfig', fireConfig) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about we add the following functionality here? const optionalFetchInterval = options.remoteConfig.minimumFetchIntervalMillis
remoteConfig.settings = {
minimumFetchIntervalMillis: optionalFetchInterval ? optionalFetchInterval : 3600000,
};
remoteConfig.defaultConfig = (options.remoteConfig.defaultConfig) So remoteConfig is setup completely and the default values can, if needed, be passed through nuxt.config.js. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That was just a quick write up, need to do it better since this will break if options.remoteConfig doesn't exist. |
||
inject('fireConfigObj', fireConfigObj) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And later we would also need to add a description to line 206