import { saveApiToken } from 'store/auth/auth-action';
import { navigateToRootProject } from 'store/navigation/navigation-action';
import { replace } from 'react-router-redux';
+import { PasswordLoginResponse } from 'views/login-panel/login-panel';
type CssRules = 'root' | 'loginBtn' | 'card' | 'wrapper' | 'progress';
});
type LoginFormProps = DispatchProp<any> & WithStyles<CssRules> & {
- handleSubmit: (username: string, password: string) => AxiosPromise;
+ handleSubmit: (username: string, password: string) => AxiosPromise<PasswordLoginResponse>;
loginLabel?: string,
};
import { ArvadosTheme } from 'common/custom-theme';
import { RootState } from 'store/store';
import { LoginForm } from 'views-components/login-form/login-form';
-import Axios from 'axios';
+import Axios, { AxiosResponse } from 'axios';
import { Config } from 'common/config';
import { sanitizeHTML } from 'common/html-sanitize';
}
});
+export type PasswordLoginResponse = {
+ uuid?: string;
+ api_token?: string;
+ message?: string;
+};
+
const doPasswordLogin = (url: string) => (username: string, password: string) => {
const formData: string[] = [];
formData.push('username='+encodeURIComponent(username));
formData.push('password='+encodeURIComponent(password));
- return Axios.post(`${url}/arvados/v1/users/authenticate`, formData.join('&'), {
+ return Axios.post<string, AxiosResponse<PasswordLoginResponse>>(`${url}/arvados/v1/users/authenticate`, formData.join('&'), {
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},