@@ -16,15 +16,11 @@ export class StoreService {
16
16
17
17
private checkIfIsTimeToClean ( ) {
18
18
// check if is time to check cachestore
19
- this . globalstore . getItem ( '_lastclean_time' ) . then ( success => {
20
- if ( success ) {
21
- if ( Date . now ( ) >= ( success . time + 12 * 3600 * 1000 ) ) {
22
- // is time to check cachestore!
23
- this . globalstore . setItem ( '_lastclean_time' , { time : Date . now ( ) } ) ;
24
- this . checkAndDeleteOldElements ( ) ;
25
- }
26
- } else {
19
+ this . globalstore . getItem ( '_lastclean_time' , true ) . then ( success => {
20
+ if ( Date . now ( ) >= ( success . time + 12 * 3600 * 1000 ) ) {
21
+ // is time to check cachestore!
27
22
this . globalstore . setItem ( '_lastclean_time' , { time : Date . now ( ) } ) ;
23
+ this . checkAndDeleteOldElements ( ) ;
28
24
}
29
25
} )
30
26
. catch ( ( ) => {
@@ -44,7 +40,6 @@ export class StoreService {
44
40
}
45
41
} )
46
42
. catch ( ( ) => { } ) ;
47
- ;
48
43
} ) ;
49
44
} )
50
45
. catch ( ( ) => { } ) ;
@@ -53,14 +48,9 @@ export class StoreService {
53
48
public getObjet ( key : string ) : Promise < object > {
54
49
let deferred = this . $q . defer ( ) ;
55
50
56
- this . allstore . getItem ( 'jsonapi.' + key )
51
+ this . allstore . getItem ( 'jsonapi.' + key , true )
57
52
. then ( success => {
58
- // problem on localForage
59
- if ( success ) {
60
- deferred . resolve ( success ) ;
61
- } else {
62
- deferred . reject ( success ) ;
63
- }
53
+ deferred . resolve ( success ) ;
64
54
} )
65
55
. catch ( error => {
66
56
deferred . reject ( error ) ;
0 commit comments