WikiTree: Use cors-anywhere only if hosted outside of apps.wikitree.com

This commit is contained in:
Przemek Wiech 2020-01-20 18:39:08 +01:00
parent ddad2f4469
commit 22aac5c444
2 changed files with 5 additions and 5 deletions

View File

@ -264,7 +264,7 @@ export class App extends React.Component<RouteComponentProps, {}> {
);
const data =
source === 'wikitree'
? await loadWikiTree(indi!, handleCors)
? await loadWikiTree(indi!)
: hash
? await loadGedcom(hash, gedcom, images)
: await loadFromUrl(url!, handleCors);

View File

@ -94,10 +94,10 @@ async function getRelatives(keys: string[], handleCors: boolean) {
* Loads data from WikiTree to populate an hourglass chart starting from the
* given person ID.
*/
export async function loadWikiTree(
key: string,
handleCors: boolean,
): Promise<TopolaData> {
export async function loadWikiTree(key: string): Promise<TopolaData> {
// Work around CORS if not in apps.wikitree.com domain.
const handleCors = window.location.hostname !== 'apps.wikitree.com';
const everyone: Person[] = [];
// Fetch the ancestors of the input person and ancestors of his/her spouses.