File tree Expand file tree Collapse file tree 1 file changed +17
-6
lines changed
projects/fusio-sdk/src/lib/component/login/provider Expand file tree Collapse file tree 1 file changed +17
-6
lines changed Original file line number Diff line number Diff line change 1
1
import { Component , OnInit } from '@angular/core' ;
2
- import { CommonMessage } from "fusio-sdk" ;
2
+ import { CommonMessage , CommonMessageException } from "fusio-sdk" ;
3
3
import { AccessToken , SessionTokenStore } from "sdkgen-client" ;
4
4
import { ActivatedRoute , Router } from "@angular/router" ;
5
5
import { UserService } from "../../../service/user.service" ;
@@ -47,13 +47,24 @@ export class ProviderComponent implements OnInit {
47
47
}
48
48
49
49
private async obtainUserInfo ( ) {
50
- const response = await this . fusio . getClient ( ) . consumer ( ) . account ( ) . get ( ) ;
50
+ try {
51
+ const response = await this . fusio . getClient ( ) . consumer ( ) . account ( ) . get ( ) ;
51
52
52
- this . user . login ( response ) ;
53
+ this . user . login ( response ) ;
53
54
54
- this . router . navigate ( [ this . config . getHomePath ( ) ] ) . then ( ( ) => {
55
- location . reload ( ) ;
56
- } ) ;
55
+ this . router . navigate ( [ this . config . getHomePath ( ) ] ) . then ( ( ) => {
56
+ location . reload ( ) ;
57
+ } ) ;
58
+ } catch ( error ) {
59
+ if ( error instanceof CommonMessageException ) {
60
+ this . response = error ;
61
+ } else {
62
+ this . response = {
63
+ success : false ,
64
+ message : String ( error )
65
+ } ;
66
+ }
67
+ }
57
68
}
58
69
59
70
}
You can’t perform that action at this time.
0 commit comments