import React from 'react'; import {Card, CardActions, CardText, CardTitle, Divider, Paper, RaisedButton, TextField,Dialog,FlatButton} from 'material-ui'; import {inject, observer} from 'mobx-react'; import './style.scss' import {LINKS} from "../../routes"; import {getMobileOperatingSystem} from '../../stores/firebase'; import {Helmet} from "react-helmet"; import LoadingDialog from '../LoadingDialog/index'; @inject('appstate') @observer export default class ForgotPasswordComponent extends React.Component { constructor(props) { super(props); this.props = props; this.state = { email: "", password: "", open : false, message : 'HAI', status : 0, loading : false }; this.defaultState = Object.assign({}, this.state); this.authStore = props.appstate.auth; this.http = props.appstate.http; this.settingStore = props.appstate.setting; } componentDidMount() { this.settingStore.getAll(); } handleTextFieldChange = (event, name) => { console.log(event.target.value); this.setState({ [name]: event.target.value }); }; forgotPassword() { this.setState({ loading : true }); this.authStore.forgetPassword({email : this.state.email}) .then(res=>{ this.setState({ loading : false, open : true, message : 'Succeed forgot password, please check your email', status : 1 }) }).catch(err=>{ this.setState({ loading : false, open : true, message : 'User with that email not found', status : 0 }) }) } closeDialog = ()=>{ if(this.state.status){ this.props.history.push(LINKS.LOGIN); } else{ this.setState({ open : false }) } } render() { const actions1 = [ this.closeDialog()} style={{marginRight: 10}} /> ]; // const applicationIcon = (this.settingStore.isIconEmpty) ? "/assets/images/logo_ikan.png" : this.http.appendImagePath(this.settingStore.setting.icon); const applicationIcon = "/assets/images/logo_ikan.png"; return (
Forgot Passwords
{/* (this.settingStore.isIconEmpty) ?

5 Roti dan 2 Ikan

:

{this.settingStore.setting.name}

*/}

Marketplace

Forgot Password

}>
this.handleTextFieldChange(event, 'email')} />
this.props.history.push(LINKS.LOGIN)}>Back to Login
this.setState({open:false})} actions={actions1} modal={true} > {this.state.message}
) } }