File tree 1 file changed +16
-4
lines changed
components/dashboard/src/settings
1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -476,10 +476,15 @@ function ListAccessTokensView() {
476
476
const [ tokens , setTokens ] = useState < PersonalAccessToken [ ] > ( [ ] ) ;
477
477
const [ tokenInfo , setTokenInfo ] = useState < TokenInfo > ( ) ;
478
478
const [ modalData , setModalData ] = useState < { token : PersonalAccessToken ; action : TokenAction } > ( ) ;
479
+ const [ errorMsg , setErrorMsg ] = useState ( "" ) ;
479
480
480
481
async function loadTokens ( ) {
481
- const response = await personalAccessTokensService . listPersonalAccessTokens ( { } ) ;
482
- setTokens ( response . tokens ) ;
482
+ try {
483
+ const response = await personalAccessTokensService . listPersonalAccessTokens ( { } ) ;
484
+ setTokens ( response . tokens ) ;
485
+ } catch ( e ) {
486
+ setErrorMsg ( e . message ) ;
487
+ }
483
488
}
484
489
485
490
useEffect ( ( ) => {
@@ -506,7 +511,7 @@ function ListAccessTokensView() {
506
511
loadTokens ( ) ;
507
512
setModalData ( undefined ) ;
508
513
} catch ( e ) {
509
- // TODO: Handle error
514
+ setErrorMsg ( e . message ) ;
510
515
}
511
516
} ;
512
517
@@ -520,7 +525,7 @@ function ListAccessTokensView() {
520
525
loadTokens ( ) ;
521
526
setModalData ( undefined ) ;
522
527
} catch ( e ) {
523
- // TODO: Handle error
528
+ setErrorMsg ( e . message ) ;
524
529
}
525
530
} ;
526
531
@@ -537,6 +542,13 @@ function ListAccessTokensView() {
537
542
</ Link >
538
543
) }
539
544
</ div >
545
+ < >
546
+ { errorMsg . length > 0 && (
547
+ < Alert type = "error" className = "mb-2" >
548
+ { errorMsg }
549
+ </ Alert >
550
+ ) }
551
+ </ >
540
552
< >
541
553
{ tokenInfo && (
542
554
< >
You can’t perform that action at this time.
0 commit comments