mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-03-11 10:03:47 +00:00
Change how WikiTree authcode is retrieved fromthe URL
This commit is contained in:
13
src/app.tsx
13
src/app.tsx
@@ -114,16 +114,18 @@ interface Arguments {
|
||||
config: Config;
|
||||
}
|
||||
|
||||
function getParamFromSearch(name: string, search: queryString.ParsedQuery<string>) {
|
||||
const value = search[name];
|
||||
return typeof value === 'string' ? value : undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve arguments passed into the application through the URL and uploaded
|
||||
* data.
|
||||
*/
|
||||
function getArguments(location: H.Location<any>): Arguments {
|
||||
const search = queryString.parse(location.search);
|
||||
const getParam = (name: string) => {
|
||||
const value = search[name];
|
||||
return typeof value === 'string' ? value : undefined;
|
||||
};
|
||||
const getParam = (name: string) => getParamFromSearch(name, search);
|
||||
|
||||
const view = getParam('view');
|
||||
const chartTypes = new Map<string | undefined, ChartType>([
|
||||
@@ -136,9 +138,10 @@ function getArguments(location: H.Location<any>): Arguments {
|
||||
const embedded = getParam('embedded') === 'true'; // False by default.
|
||||
var sourceSpec: DataSourceSpec | undefined = undefined;
|
||||
if (getParam('source') === 'wikitree') {
|
||||
const windowSearch = queryString.parse(window.location.search);
|
||||
sourceSpec = {
|
||||
source: DataSourceEnum.WIKITREE,
|
||||
authcode: getParam('authcode'),
|
||||
authcode: getParam('authcode') || getParamFromSearch('authcode', windowSearch),
|
||||
};
|
||||
} else if (hash) {
|
||||
sourceSpec = {
|
||||
|
||||
Reference in New Issue
Block a user