File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
3+ const Error = ( { error} ) => (
4+ error ?
5+ < div className = "notification is-danger" >
6+ { error }
7+ </ div > : null
8+ ) ;
9+ export default Error ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import React from 'react';
22import { Router } from 'react-router'
33
44import User from 'services/User' ;
5+ import ErrorComponent from 'components/Error/Error' ;
56
67class LoginComponent extends React . Component {
78 constructor ( props , context ) {
@@ -37,13 +38,6 @@ class LoginComponent extends React.Component{
3738 }
3839
3940 render ( ) {
40- let error = < span > </ span > ;
41- if ( this . state . error ) {
42- error = < div className = "notification is-danger" >
43- < button className = "delete" onClick = { this . handleDeleteMessage } > </ button >
44- { this . state . error }
45- </ div > ;
46- }
4741 return (
4842 < section className = "hero is-fullheight is-primary" >
4943 < div className = "hero-body" >
@@ -55,7 +49,7 @@ class LoginComponent extends React.Component{
5549 </ h1 >
5650 < form onSubmit = { this . handleSubmit } >
5751 < div className = "box" >
58- { error }
52+ < ErrorComponent error = { this . state . error } />
5953 < label className = "label" > Username</ label >
6054 < p className = "control" >
6155 < input
You can’t perform that action at this time.
0 commit comments