Merge branch '20031-collection-files-batch-operations' into main. Closes #20031
[arvados.git] / src / views-components / add-session / add-session.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
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";
11
12 export const AddSession = connect()(
13     class extends React.Component<RouteProps & DispatchProp<any>, {}> {
14         componentDidMount() {
15             const search = this.props.location ? this.props.location.search : "";
16             const apiToken = getUrlParameter(search, 'api_token');
17             const baseURL = getUrlParameter(search, 'baseURL');
18
19             this.props.dispatch(addSession(baseURL, apiToken));
20             this.props.dispatch(navigateToSiteManager);
21         }
22         render() {
23             return <div />;
24         }
25     }
26 );