Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Imperative: | |
//Too many if-else and null checks; relying on global indexURLs; decided that "en" urls are default for any country | |
const getUrlForUser = (user) => { | |
if (user == null) { //not logged in | |
return indexURLs['en']; //return default page | |
} | |
if (user.prefs.languages.primary && user.prefs.languages.primary != 'undefined') { | |
if (indexURLs[user.prefs.languages.primary]) {//if translation exists, | |
return indexURLs[user.prefs.languages.primary]; | |
} else { |
OlderNewer