File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -19,18 +19,19 @@ export class UrlboardComponent {
19
19
. fetchUrls ( )
20
20
. then ( ( d ) => ( this . state . urls = d . results ) )
21
21
. catch ( ( _ ) => {
22
- this . state . fetchUrlsError = 'Error fetching your urls' ;
22
+ this . state . fetchUrlsError = true ;
23
23
} ) ;
24
24
}
25
25
26
26
onSubmit ( ) {
27
27
this . state . processingRequest = true ;
28
28
setTimeout (
29
29
( ) => {
30
+ this . state . requestError = false ;
30
31
this . service
31
32
. shortenUrl ( this . state . form . get ( 'url' ) ?. value )
32
33
. then ( ( d ) => this . state . urls ?. unshift ( d ) )
33
- . catch ( ( e ) => console . log ( e ) )
34
+ . catch ( ( _ ) => ( this . state . requestError = true ) )
34
35
. finally ( ( ) => ( this . state . processingRequest = false ) ) ;
35
36
} ,
36
37
environment . production ? 0 : 3000
Original file line number Diff line number Diff line change @@ -42,9 +42,9 @@ class MainScreenState {
42
42
43
43
class URLBoardState {
44
44
urls : URL [ ] | null = null ;
45
- fetchUrlsError : string | null = null ;
45
+ fetchUrlsError : boolean = false ;
46
46
processingRequest : boolean = false ;
47
- requestError : string | null = null ;
47
+ requestError : boolean = false ;
48
48
form : FormGroup ;
49
49
50
50
constructor ( fb : FormBuilder ) {
You can’t perform that action at this time.
0 commit comments