used created grooming utils function

This commit is contained in:
u-e 2019-01-16 11:25:53 +03:00
parent 95d8816536
commit 62e68a5998
2 changed files with 6 additions and 6 deletions

View File

@ -78,9 +78,9 @@ class SettingsScreen extends PureComponent {
})} })}
type="dropdown" type="dropdown"
actionType="api" actionType="api"
options={serverList.map(server => server)} options={serverList.map(serverName => groomingServerName(serverName))}
selectedOptionIndex={serverList.indexOf(selectedApi)} selectedOptionIndex={serverList.indexOf(selectedApi)}
defaultText={selectedApi} defaultText={groomingServerName(selectedApi)}
handleOnChange={handleOnChange} handleOnChange={handleOnChange}
/> />
<SettingsItem <SettingsItem

View File

@ -4,11 +4,11 @@ export const groomingServerName = (serverName) => {
if (!serverName) return null; if (!serverName) return null;
if (serverName.indefOf(PREFIX1) === 0) { if (serverName.indexOf(PREFIX1) === 0) {
return serverName.str.substr(PREFIX1.length); return serverName.substr(PREFIX1.length);
} }
if (serverName.indefOf(PREFIX2) === 0) { if (serverName.indexOf(PREFIX2) === 0) {
return serverName.str.substr(PREFIX2.length); return serverName.substr(PREFIX2.length);
} }
return serverName; return serverName;
}; };