File tree 2 files changed +14
-13
lines changed
2 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -34,20 +34,21 @@ workbox.routing.registerRoute(
34
34
}
35
35
) ;
36
36
37
- const auth = new AuthApiImpl ( ) ;
38
- auth . getUserId ( ) . then (
39
- function ( userId ) {
40
- if ( userId ) {
41
- const remoteSync = new DataSynchronizer ( new IndexedDb ( ) , new FirestoreApi ( userId ) ) ;
42
- self . addEventListener ( 'sync' , event => {
43
- if ( event . tag === SyncDirection . LocalToRemote ) {
37
+ self . addEventListener ( 'sync' , event => {
38
+ if ( event . tag === SyncDirection . LocalToRemote ) {
39
+
40
+ const auth = new AuthApiImpl ( ) ;
41
+ auth . getUserId ( ) . then (
42
+ function ( userId ) {
43
+ if ( userId ) {
44
+ const remoteSync = new DataSynchronizer ( new IndexedDb ( ) , new FirestoreApi ( userId ) ) ;
44
45
remoteSync . sync ( ) ;
45
46
}
46
- } ) ;
47
-
48
- }
47
+ }
48
+ )
49
49
}
50
- )
50
+ } ) ;
51
+
51
52
52
53
/** TODO use it to retry firestore failed requests
53
54
*
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ export function Sync(props: HeaderNotifierProps&RouterProps) {
54
54
console . error ( error ) ;
55
55
}
56
56
if ( uid ) {
57
- await btApp . cleanupStorage ( ) ;
57
+ await btApp . refreshStores ( ) ;
58
58
}
59
59
setIsLoggedIn ( ! ! uid ) ;
60
60
}
@@ -74,7 +74,7 @@ export function Sync(props: HeaderNotifierProps&RouterProps) {
74
74
setError ( 'There were some problems signing out' ) ;
75
75
console . error ( error ) ;
76
76
}
77
- await btApp . cleanupStorage ( ) ;
77
+ await btApp . refreshStores ( ) ;
78
78
setIsLoggedIn ( ! ! uid ) ;
79
79
}
80
80
You can’t perform that action at this time.
0 commit comments