mirror of
https://github.com/PeWu/topola-viewer.git
synced 2026-05-26 23:26:15 +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;
|
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
|
* Retrieve arguments passed into the application through the URL and uploaded
|
||||||
* data.
|
* data.
|
||||||
*/
|
*/
|
||||||
function getArguments(location: H.Location<any>): Arguments {
|
function getArguments(location: H.Location<any>): Arguments {
|
||||||
const search = queryString.parse(location.search);
|
const search = queryString.parse(location.search);
|
||||||
const getParam = (name: string) => {
|
const getParam = (name: string) => getParamFromSearch(name, search);
|
||||||
const value = search[name];
|
|
||||||
return typeof value === 'string' ? value : undefined;
|
|
||||||
};
|
|
||||||
|
|
||||||
const view = getParam('view');
|
const view = getParam('view');
|
||||||
const chartTypes = new Map<string | undefined, ChartType>([
|
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.
|
const embedded = getParam('embedded') === 'true'; // False by default.
|
||||||
var sourceSpec: DataSourceSpec | undefined = undefined;
|
var sourceSpec: DataSourceSpec | undefined = undefined;
|
||||||
if (getParam('source') === 'wikitree') {
|
if (getParam('source') === 'wikitree') {
|
||||||
|
const windowSearch = queryString.parse(window.location.search);
|
||||||
sourceSpec = {
|
sourceSpec = {
|
||||||
source: DataSourceEnum.WIKITREE,
|
source: DataSourceEnum.WIKITREE,
|
||||||
authcode: getParam('authcode'),
|
authcode: getParam('authcode') || getParamFromSearch('authcode', windowSearch),
|
||||||
};
|
};
|
||||||
} else if (hash) {
|
} else if (hash) {
|
||||||
sourceSpec = {
|
sourceSpec = {
|
||||||
|
|||||||
Reference in New Issue
Block a user