Log login success rate
Summary: Report login success rate Reviewed By: mweststrate Differential Revision: D22698005 fbshipit-source-id: 5f02a2ddaaf54acc564d09a5f781ed649ae8a3e6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
6561bc8f16
commit
ce180a106f
@@ -25,6 +25,7 @@ import {connect} from 'react-redux';
|
|||||||
import {State as Store} from '../reducers';
|
import {State as Store} from '../reducers';
|
||||||
import ContextMenu from '../ui/components/ContextMenu';
|
import ContextMenu from '../ui/components/ContextMenu';
|
||||||
import {clipboard} from 'electron';
|
import {clipboard} from 'electron';
|
||||||
|
import {reportPlatformFailures} from '../utils/metrics';
|
||||||
|
|
||||||
const Container = styled(FlexColumn)({
|
const Container = styled(FlexColumn)({
|
||||||
padding: 20,
|
padding: 20,
|
||||||
@@ -69,9 +70,7 @@ class SignInSheet extends Component<Props, State> {
|
|||||||
error: null,
|
error: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
saveToken = async (token: string) => {
|
login = async (token: string) => {
|
||||||
this.setState({token, loading: true});
|
|
||||||
try {
|
|
||||||
await writeKeychain(token);
|
await writeKeychain(token);
|
||||||
const user = await getUser();
|
const user = await getUser();
|
||||||
if (user) {
|
if (user) {
|
||||||
@@ -79,6 +78,12 @@ class SignInSheet extends Component<Props, State> {
|
|||||||
} else {
|
} else {
|
||||||
throw new Error('Failed to login using the provided token');
|
throw new Error('Failed to login using the provided token');
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
saveToken = async (token: string) => {
|
||||||
|
this.setState({token, loading: true});
|
||||||
|
try {
|
||||||
|
await reportPlatformFailures(this.login(token), 'auth:login');
|
||||||
this.setState({loading: false});
|
this.setState({loading: false});
|
||||||
this.props.onHide();
|
this.props.onHide();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user