seting site_id automatically only for localhost

This commit is contained in:
Cássio Zen 2016-07-20 13:46:52 -03:00
parent 7345c7bd32
commit d7324bd743
2 changed files with 8 additions and 3 deletions

View File

@ -14,8 +14,13 @@ export default class AuthenticationPage extends React.Component {
handleLogin(e) {
e.preventDefault();
let auth;
if (document.location.host.split(':')[0] === 'localhost') {
auth = new Authenticator({ site_id: 'cms.netlify.com' });
} else {
auth = new Authenticator();
}
const auth = new Authenticator({site_id: 'cms.netlify.com'});
auth.authenticate({provider: 'github', scope: 'repo'}, (err, data) => {
if (err) {
this.setState({loginError: err.toString()});

View File

@ -29,8 +29,8 @@ const PROVIDERS = {
};
class Authenticator {
constructor(config) {
this.site_id = config.site_id;
constructor(config = {}) {
this.site_id = config.site_id || null;
this.base_url = config.base_url || NETLIFY_API;
}