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