Log login success rate

Summary: Report login success rate

Reviewed By: mweststrate

Differential Revision: D22698005

fbshipit-source-id: 5f02a2ddaaf54acc564d09a5f781ed649ae8a3e6
This commit is contained in:
Anton Nikolaev
2020-07-24 02:44:25 -07:00
committed by Facebook GitHub Bot
parent 6561bc8f16
commit ce180a106f

View File

@@ -25,6 +25,7 @@ import {connect} from 'react-redux';
import {State as Store} from '../reducers';
import ContextMenu from '../ui/components/ContextMenu';
import {clipboard} from 'electron';
import {reportPlatformFailures} from '../utils/metrics';
const Container = styled(FlexColumn)({
padding: 20,
@@ -69,16 +70,20 @@ class SignInSheet extends Component<Props, State> {
error: null,
};
login = async (token: string) => {
await writeKeychain(token);
const user = await getUser();
if (user) {
this.props.login(user);
} else {
throw new Error('Failed to login using the provided token');
}
};
saveToken = async (token: string) => {
this.setState({token, loading: true});
try {
await writeKeychain(token);
const user = await getUser();
if (user) {
this.props.login(user);
} else {
throw new Error('Failed to login using the provided token');
}
await reportPlatformFailures(this.login(token), 'auth:login');
this.setState({loading: false});
this.props.onHide();
} catch (error) {