mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-05-26 23:26:15 +00:00
WikiTree: Use cors-anywhere only if hosted outside of apps.wikitree.com
This commit is contained in:
@@ -264,7 +264,7 @@ export class App extends React.Component<RouteComponentProps, {}> {
|
|||||||
);
|
);
|
||||||
const data =
|
const data =
|
||||||
source === 'wikitree'
|
source === 'wikitree'
|
||||||
? await loadWikiTree(indi!, handleCors)
|
? await loadWikiTree(indi!)
|
||||||
: hash
|
: hash
|
||||||
? await loadGedcom(hash, gedcom, images)
|
? await loadGedcom(hash, gedcom, images)
|
||||||
: await loadFromUrl(url!, handleCors);
|
: await loadFromUrl(url!, handleCors);
|
||||||
|
|||||||
@@ -94,10 +94,10 @@ async function getRelatives(keys: string[], handleCors: boolean) {
|
|||||||
* Loads data from WikiTree to populate an hourglass chart starting from the
|
* Loads data from WikiTree to populate an hourglass chart starting from the
|
||||||
* given person ID.
|
* given person ID.
|
||||||
*/
|
*/
|
||||||
export async function loadWikiTree(
|
export async function loadWikiTree(key: string): Promise<TopolaData> {
|
||||||
key: string,
|
// Work around CORS if not in apps.wikitree.com domain.
|
||||||
handleCors: boolean,
|
const handleCors = window.location.hostname !== 'apps.wikitree.com';
|
||||||
): Promise<TopolaData> {
|
|
||||||
const everyone: Person[] = [];
|
const everyone: Person[] = [];
|
||||||
|
|
||||||
// Fetch the ancestors of the input person and ancestors of his/her spouses.
|
// Fetch the ancestors of the input person and ancestors of his/her spouses.
|
||||||
|
|||||||
Reference in New Issue
Block a user