Prevent race condition with headers

This commit is contained in:
Iván Ovejero 2021-12-02 14:09:41 +01:00
parent d2c79d3ef0
commit e22febb3f3

View file

@ -240,9 +240,6 @@ export default mixins(
// TODO i18n: Remove next line // TODO i18n: Remove next line
console.log(`Switching locale from ${oldLocale} to ${newLocale}`); // eslint-disable-line no-console console.log(`Switching locale from ${oldLocale} to ${newLocale}`); // eslint-disable-line no-console
loadLanguage(newLocale); loadLanguage(newLocale);
const headers = await this.restApi().getNodeTranslationHeaders();
addHeaders(headers, this.$store.getters.defaultLocale);
}, },
}, },
async beforeRouteLeave(to, from, next) { async beforeRouteLeave(to, from, next) {
@ -2569,6 +2566,11 @@ export default mixins(
try { try {
await Promise.all(loadPromises); await Promise.all(loadPromises);
if (this.defaultLocale !== 'en') {
const headers = await this.restApi().getNodeTranslationHeaders();
addHeaders(headers, this.defaultLocale);
}
} catch (error) { } catch (error) {
this.$showError( this.$showError(
error, error,