File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -6,20 +6,30 @@ export default Ember.Object.extend({
6
6
currentUser : null ,
7
7
8
8
init : function ( ) {
9
- this . set ( 'isLoggedIn' , localStorage . getItem ( 'isLoggedIn' ) === '1' ) ;
9
+ var isLoggedIn ;
10
+ try {
11
+ isLoggedIn = localStorage . getItem ( 'isLoggedIn' ) === '1' ;
12
+ } catch ( e ) {
13
+ isLoggedIn = false ;
14
+ }
15
+ this . set ( 'isLoggedIn' , isLoggedIn ) ;
10
16
this . set ( 'currentUser' , null ) ;
11
17
} ,
12
18
13
19
loginUser : function ( user ) {
14
20
this . set ( 'isLoggedIn' , true ) ;
15
21
this . set ( 'currentUser' , user ) ;
16
- localStorage . setItem ( 'isLoggedIn' , '1' ) ;
22
+ try {
23
+ localStorage . setItem ( 'isLoggedIn' , '1' ) ;
24
+ } catch ( e ) { }
17
25
} ,
18
26
19
27
logoutUser : function ( ) {
20
28
this . set ( 'savedTransition' , null ) ;
21
29
this . set ( 'isLoggedIn' , null ) ;
22
30
this . set ( 'currentUser' , null ) ;
23
- localStorage . removeItem ( 'isLoggedIn' ) ;
31
+ try {
32
+ localStorage . removeItem ( 'isLoggedIn' ) ;
33
+ } catch ( e ) { }
24
34
} ,
25
35
} ) ;
You can’t perform that action at this time.
0 commit comments