File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export default class SearchBar extends Component {
15
15
userData : [ ] ,
16
16
searchButton : 'Search' ,
17
17
}
18
-
18
+
19
19
}
20
20
handleChange = ( e ) => {
21
21
this . setState ( {
@@ -53,6 +53,17 @@ export default class SearchBar extends Component {
53
53
searchButton : 'Search'
54
54
} ) ;
55
55
console . log ( this . state )
56
+ } ) . catch ( error => {
57
+ if ( error . response ) {
58
+ if ( error . response . status === 404 ) {
59
+ toast . warn ( 'Username not found' ) ;
60
+ this . setState ( {
61
+ reposData : [ ] ,
62
+ userData : [ ] ,
63
+ searchButton : 'Search'
64
+ } ) ;
65
+ }
66
+ }
56
67
} ) ;
57
68
}
58
69
@@ -67,7 +78,7 @@ export default class SearchBar extends Component {
67
78
< Avatar
68
79
data = { this . state . userData }
69
80
/>
70
- < PanelBoard
81
+ < PanelBoard
71
82
data = { this . state . reposData }
72
83
/>
73
84
< ToastContainer
@@ -76,16 +87,16 @@ export default class SearchBar extends Component {
76
87
autoClose = { 3000 }
77
88
/>
78
89
</ div >
79
-
90
+
80
91
) ;
81
92
}
82
93
}
83
94
84
95
class PanelBoard extends Component {
85
-
96
+
86
97
render ( ) {
87
98
const repos = this . props . data . map ( ( repo ) => (
88
-
99
+
89
100
< ResultPanel
90
101
id = { repo . id }
91
102
key = { repo . id }
You can’t perform that action at this time.
0 commit comments