add set default if storage empty
This commit is contained in:
parent
9ccea7f635
commit
abfd27949f
2 changed files with 16 additions and 3 deletions
|
|
@ -16,9 +16,19 @@ export class AppComponent implements OnInit {
|
|||
// lang
|
||||
Lang.initLanguageSwitcher();
|
||||
|
||||
// set default country and filename
|
||||
await AsyncStorage.setItem('currentRecipeCountry', 'Thailand');
|
||||
await AsyncStorage.setItem('currentFile', 'default');
|
||||
// set default country and filename if empty
|
||||
|
||||
let currentCountry = await AsyncStorage.getItem('currentRecipeCountry');
|
||||
let currentFile = await AsyncStorage.getItem('currentRecipeFile');
|
||||
|
||||
if (!currentCountry) {
|
||||
await AsyncStorage.setItem('currentRecipeCountry', 'Thailand');
|
||||
}
|
||||
|
||||
if (!currentFile) {
|
||||
await AsyncStorage.setItem('currentRecipeFile', 'default');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue