X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=cmd%2Fweb%2Fjs%2Fsignin.jsx;h=e0e0f1de8cfc4a962adb8eb6107c583debf15a1b;hb=d5b8f0ffbbde5fb8d41c3abb4b0969b962746b52;hp=a2cfd1b91843c909003624da8ccd554c4c7bd7e5;hpb=2f91f20a8645339385ada602684f4957f20f4da4;p=perso%2FImmae%2FProjets%2FCryptomonnaies%2FCryptoportfolio%2FFront.git diff --git a/cmd/web/js/signin.jsx b/cmd/web/js/signin.jsx index a2cfd1b..e0e0f1d 100644 --- a/cmd/web/js/signin.jsx +++ b/cmd/web/js/signin.jsx @@ -1,12 +1,15 @@ -var Api = require('./api.js').Api; -var App = require('./app.js'); -var classNames = require('classnames'); - -module.exports.SigninForm = React.createClass({ - getInitialState: function() { - return {'hideMsg': true, 'msg': '', 'msgOk': false, 'password': '', 'email': ''}; - }, - handleSubmit: function(e) { +import Api from './api.js'; +import App from './app.js'; +import classNames from 'classnames'; +import React from 'react'; + +class SigninForm extends React.Component { + constructor(props) { + super(props); + this.state = {'hideMsg': true, 'msg': '', 'msgOk': false, 'password': '', 'email': ''}; + } + + handleSubmit = (e) => { Api.Call('SIGNIN', {'password': this.state.password, 'email': this.state.email}, function(err, status, data) { if (err) { console.error(err, data); @@ -19,34 +22,41 @@ module.exports.SigninForm = React.createClass({ }.bind(this)); e.preventDefault(); - }, - handlePasswordChange: function(event) { + } + + handlePasswordChange = (event) => { this.setState({'password': event.target.value}); - }, - handleEmailChange: function(event) { + } + + handleEmailChange = (event) => { this.setState({'email': event.target.value}); - }, - hideMessage: function() { + } + + hideMessage = () => { this.setState({'hideMsg': true}); - }, - displayMessage: function(msg, ok) { + } + + displayMessage = (msg, ok) => { this.setState({'msg': msg, 'msgOk': ok, 'hideMsg': false}); - }, - render: function() { + } + + render = () => { var cName = classNames('form-message', {'hidden': this.state.hideMsg, 'message-ok': this.state.msgOk}); return ( -
-
-
- - - -
{this.state.msg}
+
+
+ + + + +
{this.state.msg}
- Sign up + Sign up
); } -}); +} + +export default SigninForm;