Fix project preselection when project identifier is not defined (#9)

This commit is contained in:
Manuel Bouza
2019-04-01 17:41:54 +02:00
committed by Tobias Miesel
parent 1533c2261f
commit 1d2e336e3d
3 changed files with 14 additions and 7 deletions

View File

@@ -21,11 +21,17 @@ export const ERROR_UNKNOWN = "unknown"
export const noop = () => null
export const findProjectBy = prop => val =>
compose(
export const findProjectBy = prop => val => projects => {
if (!val) {
return undefined
}
return compose(
find(pathEq(prop, val)),
flatMap(get("options"))
)
)(projects)
}
export const findProjectByIdentifier = findProjectBy("identifier")
export const findProjectByValue = findProjectBy("value")