File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -44,17 +44,21 @@ export default class Auth {
44
44
return Promise . resolve ( )
45
45
}
46
46
}
47
-
48
- // Call mounted for active strategy on initial load
49
- await this . mounted ( )
50
-
51
- // Watch for loggedIn changes only in client side
52
- if ( process . browser && this . options . watchLoggedIn ) {
53
- this . $storage . watchState ( 'loggedIn' , loggedIn => {
54
- if ( ! routeOption ( this . ctx . route , 'auth' , false ) ) {
55
- this . redirect ( loggedIn ? 'home' : 'logout' )
56
- }
57
- } )
47
+
48
+ try {
49
+ // Call mounted for active strategy on initial load
50
+ await this . mounted ( )
51
+ } catch ( error ) {
52
+ this . callOnError ( error )
53
+ } finally {
54
+ // Watch for loggedIn changes only in client side
55
+ if ( process . client && this . options . watchLoggedIn ) {
56
+ this . $storage . watchState ( 'loggedIn' , loggedIn => {
57
+ if ( ! routeOption ( this . ctx . route , 'auth' , false ) ) {
58
+ this . redirect ( loggedIn ? 'home' : 'logout' )
59
+ }
60
+ } )
61
+ }
58
62
}
59
63
}
60
64
You can’t perform that action at this time.
0 commit comments