WikiTree: Make it work when passing numeric WikiTree ID instead of name

This commit is contained in:
Przemek Wiech
2020-02-14 13:31:51 +01:00
parent 6902305824
commit 3fef2dd61d

View File

@@ -10,10 +10,11 @@ export function getSelection(
indi?: string,
generation?: number,
): IndiInfo {
return {
id: indi || data.indis[0].id,
generation: generation || 0,
};
// If ID is not given or it doesn't exist in the data, use the first ID in
// the data.
const id =
indi && data.indis.some((i) => i.id === indi) ? indi : data.indis[0].id;
return {id, generation: generation || 0};
}
function prepareData(