aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/LoginButton.js
blob: 8d298fa2d6e2cc306cb6e7022e6f68fbfb8a9fd3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import React from 'react'
import PropTypes from 'prop-types'

export default class LoginButton extends React.Component {
  constructor(props) {
    super(props);
    window.addEventListener("message", (event) => {
      this.props.onAuth(event.data);
    }, false);
  }
  login(event) {
    event.preventDefault();
    let loginWindow = window.open("https://juick.com/login?redirect=false", "Login to Juick", "width=400,height=300,resizeable=no,menubar=no,toolbar=no,scrollbars=no");
    loginWindow.window.focus();
  }

  render() {
    return (
    <a href="/login" onClick={this.login}>{this.props.title}</a>
    )
  }
};

LoginButton.propTypes = {
  title: PropTypes.string.isRequired,
  onAuth: PropTypes.func.isRequired
}