Description
Technologies: vue and firebaseui
Problem: I can not update firebaseui widget more than once per language (I am using three languages: 'en-us' for English, 'es' for Spanish, en and 'ca' for Catalonian).
I can update firebaseui widget
but only once per language. After that, the firebaseui widget
always stays in the last chosen language.
Flow example:
Step 1: Landing page is in Spanish and I go to sign-in section; then, firebaseui widget
appears in Spanish
Step 2: I update the language to Catalonian; then, firebaseui widget
updates to Catalonian
Step 3: I update the language to Spanish (widget was in Spanish before, it will not update to Spanisg again); then, firebaseui widget
remains in Catalonian
Step 4: I update the language to English; then, firebaseui widget
updates to English
(All three languages have been selected at least once...)
Step n: I update the language to any language; then, firebaseui widget
always will remain in English (the last one chosen)
I have build the localized npm FirebaseUI module for my three languages (English, Spanish and Catalonian). Following the docs.
And I use a watch for landingPageLang
state in order to execute the getFirebaseui
method for getting ready the firebaseui widget in the selected language (landingPageLang
state).
The code is the following:
getFirebaseui: async function (uiConfig) {
try {
// dynamic import to get the right module
const firebaseui = await ((lang) => {
switch (lang) {
case 'es': return import('firebaseui/dist/npm__es')
case 'ca': return import('firebaseui/dist/npm__ca')
case 'en-us': return import('firebaseui/dist/npm__en')
default: return import('firebaseui/dist/npm__en')
}
})(this.landingPageLang)
// code to get ready the widget
if (this.ui) {
// await this.ui.reset()
await this.ui.delete()
}
this.ui = await firebaseui.auth.AuthUI.getInstance()
if (!this.ui) {
this.ui = await new firebaseui.auth.AuthUI(this.$fb.auth())
}
await this.ui.reset()
await this.ui.start('#firebaseui-auth-container', uiConfig)
} catch (error) {
this.$utils.loggerOn() &&
console.error('Auth error:', error)
}
}
Maybe the code below the comment //code to get ready the widget
is not very clean and some awaits are not useful, but the code works and updates the firebaseui widget
once for each language, so I guess the problem is not there.
Any indication? Thanks!
(No execution errors appear in the code)