Commit 301fce9d authored by Matija Obreza's avatar Matija Obreza
Browse files

Only show Overviews

- use showOverview(...)
parent 16db7b3a
......@@ -8,6 +8,7 @@ import { reconfigureServiceAxios, LoginService } from '@genesys/client/service';
import App from './ui/App';
import ApiAccessError from './ui/ApiAccessError';
import { Config, DefaultConfig } from '../config/config';
import OverviewPage from './ui/OverviewPage';
// declare const window: Window & { devToolsExtension: any, __REDUX_DEVTOOLS_EXTENSION_COMPOSE__: any, initialLanguage: any, initialI18nStore: any, localeMapping: any };
// const AUTH_COOKIE = 'GENESYS_AUTH';
......@@ -62,3 +63,25 @@ export function showGenesysUI(holdingNode: HTMLElement, config: Config = Default
);
});
}
export function showOverview(holdingNode: HTMLElement, config: Config = DefaultConfig, language: string = 'en') {
const { apiUrl, clientId, clientKey, filter } = config;
reconfigureServiceAxios({ apiUrl });
initI18n(language);
checkAccessTokens(apiUrl, clientId, clientKey).then( (result) => {
ReactDOM.render(
<OverviewPage filter={ filter } />,
holdingNode,
);
}).catch((err) => {
log('Oh, oh', err);
ReactDOM.render(
<ApiAccessError error={ err } apiUrl={ apiUrl } />,
holdingNode,
);
});
}
import * as React from 'react';
import { WithTranslation, withTranslation } from 'react-i18next';
import { parse } from 'query-string';
// Models
import { IPageRequest } from '@genesys/client/model/FilteredPage';
import { AccessionService } from '@genesys/client/service';
// UI
......@@ -12,7 +10,6 @@ import AccessionFilter from '@genesys/client/model/accession/AccessionFilter';
interface IOverviewPageProps extends React.ClassAttributes<any>, WithTranslation {
filter: AccessionFilter;
location: any;
}
class BrowsePage extends React.Component<IOverviewPageProps, any> {
......@@ -25,9 +22,9 @@ class BrowsePage extends React.Component<IOverviewPageProps, any> {
}
}
private loadData = (pageR: IPageRequest): Promise<any> => {
private loadData = (): Promise<any> => {
return AccessionService
.listOverview(this.props.filter, pageR)
.listOverview(this.props.filter)
.then((data) => {
console.log('overview: ', data);
this.setState({ overviewData: data });
......@@ -40,8 +37,7 @@ class BrowsePage extends React.Component<IOverviewPageProps, any> {
public componentDidMount() {
if (typeof window !== 'undefined') { // Call should be started only on client side
const current = +parse(this.props.location.search).p
this.loadData(current ? { page: current } : {});
this.loadData();
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment