mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-11-12 04:25:31 +08:00
379d11b31a
Summary: Future services that require OAuth get a cute new component that lets them connect more easily. Test Plan: Tested manually. Reviewers: juan, evan Reviewed By: evan Differential Revision: https://phab.nylas.com/D3186
46 lines
1.1 KiB
JavaScript
46 lines
1.1 KiB
JavaScript
import React from 'react';
|
|
import {OAuthSignInPage} from 'nylas-component-kit';
|
|
|
|
import {
|
|
makeGmailOAuthRequest,
|
|
buildGmailSessionKey,
|
|
buildGmailAuthURL,
|
|
} from './onboarding-helpers';
|
|
|
|
import OnboardingActions from './onboarding-actions';
|
|
import AccountTypes from './account-types';
|
|
|
|
|
|
export default class AccountSettingsPageGmail extends React.Component {
|
|
static displayName = "AccountSettingsPageGmail";
|
|
|
|
static propTypes = {
|
|
accountInfo: React.PropTypes.object,
|
|
};
|
|
|
|
constructor() {
|
|
super()
|
|
this._sessionKey = buildGmailSessionKey();
|
|
this._gmailAuthUrl = buildGmailAuthURL(this._sessionKey)
|
|
}
|
|
|
|
onSuccess(account) {
|
|
OnboardingActions.accountJSONReceived(account);
|
|
}
|
|
|
|
render() {
|
|
const {accountInfo} = this.props;
|
|
const iconName = AccountTypes.find(a => a.type === accountInfo.type).headerIcon;
|
|
|
|
return (
|
|
<OAuthSignInPage
|
|
authUrl={this._gmailAuthUrl}
|
|
iconName={iconName}
|
|
makeRequest={makeGmailOAuthRequest}
|
|
onSuccess={this.onSuccess}
|
|
serviceName="Gmail"
|
|
sessionKey={this._sessionKey}
|
|
/>
|
|
);
|
|
}
|
|
}
|