1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { RouteProps } from "react-router";
6 import React from "react";
7 import { connect, DispatchProp } from "react-redux";
8 import { getUrlParameter } from "common/url";
9 import { navigateToSiteManager } from "store/navigation/navigation-action";
10 import { addSession } from "store/auth/auth-action-session";
12 export const AddSession = connect()(
13 class extends React.Component<RouteProps & DispatchProp<any>, {}> {
15 const search = this.props.location ? this.props.location.search : "";
16 const apiToken = getUrlParameter(search, 'api_token');
17 const baseURL = getUrlParameter(search, 'baseURL');
19 this.props.dispatch(addSession(baseURL, apiToken));
20 this.props.dispatch(navigateToSiteManager);