mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-03-11 17:23:41 +00:00
Resolve "Auth providers should be ready on components init"
This commit is contained in:
@@ -22,6 +22,7 @@ import {
|
||||
} from '@openstapps/core';
|
||||
import {NavigationService} from './navigation.service';
|
||||
import config from 'capacitor.config';
|
||||
import {SettingsProvider} from '../../settings/settings.provider';
|
||||
|
||||
/**
|
||||
* Generated class for the MenuPage page.
|
||||
@@ -43,23 +44,13 @@ export class NavigationComponent implements OnInit {
|
||||
/**
|
||||
* Possible languages to be used for translation
|
||||
*/
|
||||
language: keyof SCTranslations<SCLanguage> = 'en';
|
||||
language: keyof SCTranslations<SCLanguage>;
|
||||
|
||||
/**
|
||||
* Menu entries from config module
|
||||
*/
|
||||
menu: SCAppConfigurationMenuCategory[];
|
||||
|
||||
/**
|
||||
* Possible languages to be used for translation
|
||||
*/
|
||||
public pages = [
|
||||
{title: 'Search', url: '/search', icon: 'search'},
|
||||
{title: 'Hebis Search', url: '/hebis-search', icon: 'search'},
|
||||
{title: 'Schedule', url: '/schedule', icon: 'calendar'},
|
||||
{title: 'Settings', url: '/settings', icon: 'settings'},
|
||||
];
|
||||
|
||||
/**
|
||||
* Core translator
|
||||
*/
|
||||
@@ -68,15 +59,20 @@ export class NavigationComponent implements OnInit {
|
||||
constructor(
|
||||
public translateService: TranslateService,
|
||||
private navigationService: NavigationService,
|
||||
private settingsProvider: SettingsProvider,
|
||||
) {
|
||||
translateService.onLangChange.subscribe((event: LangChangeEvent) => {
|
||||
this.language = event.lang as keyof SCTranslations<SCLanguage>;
|
||||
this.translator = new SCThingTranslator(this.language);
|
||||
});
|
||||
this.translator = new SCThingTranslator('en');
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
this.language = (await this.settingsProvider.getValue(
|
||||
'profile',
|
||||
'language',
|
||||
)) as keyof SCTranslations<SCLanguage>;
|
||||
this.translator = new SCThingTranslator(this.language);
|
||||
this.menu = await this.navigationService.getMenu();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
<ion-content>
|
||||
<ion-content *ngIf="menu">
|
||||
<ion-list *ngFor="let category of menu">
|
||||
<ion-list-header *ngIf="category.name !== ''">
|
||||
<ion-label>
|
||||
|
||||
Reference in New Issue
Block a user