diff --git a/pages/register.js b/pages/register.js index 83506e6..2d84200 100644 --- a/pages/register.js +++ b/pages/register.js @@ -1,10 +1,12 @@ import Head from 'next/head'; import React from 'react'; +import PropTypes from 'prop-types'; import {connect} from 'react-redux'; import {notify} from 'react-notify-toast'; import Router from 'next/router'; import { - Button, Card, CardBody, Container, Form, FormGroup, FormText, Input, Label + Button, Card, CardBody, Container, Form, FormGroup, FormText, Input, Label, + Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import {TurniereNavigation} from '../js/components/Navigation'; @@ -71,12 +73,15 @@ class RegisterForm extends React.Component { super(props); this.state = { - username: '', email: '', password: '' + username: '', email: '', password: '', + showRegisterSuccessModal: false, code: -1 }; } render() { return (
); } + showRegisterSuccessModal() { + this.setState({ + showRegisterSuccessModal: true + }); + } + + closeRegisterSuccessModal() { + Router.push('/'); + } + registerUser() { - register( - this.state.username, this.state.email, this.state.password, () => { - notify.show('Sie wurden erfolgreich registriert, ' + this.state.username + '!', 'success', 5000); - Router.push('/'); - }, () => { - notify.show('Sie konnten nicht registriert werden.', 'warning', 5000); - }); + register(this.state.username, this.state.email, this.state.password, () => { + this.showRegisterSuccessModal(); + }, () => { + notify.show('Sie konnten nicht registriert werden.', 'warning', 5000); + }); } handlePasswordInput(input) { @@ -126,6 +139,26 @@ class RegisterForm extends React.Component { } } +class RegisterSuccessModal extends React.Component { + render() { + return (