@@ -21,18 +21,18 @@ import { getNumUnsyncedMutationsObservable } from "../sync/numUnsyncedMutations"
21
21
* @param newUser
22
22
*/
23
23
export async function setCurrentUser ( db : DexieCloudDB , user : AuthPersistedContext ) {
24
- const currentUserObservable = db . cloud . currentUserObservable ;
24
+ const currentUserObservable = db . cloud . currentUser ;
25
25
if ( ! currentUserObservable )
26
26
throw new Error ( `Given Dexie instance doesn't have the dexie-cloud addon.` ) ;
27
- if ( user . userId === db . cloud . currentUser . userId ) return ; // Already this user.
27
+ if ( user . userId === db . cloud . currentUserId ) return ; // Already this user.
28
28
29
29
// Yes, I know, we're calling authenticate() again (if you were following login.ts and came here.)
30
30
// But this function can also be called from db.ready!
31
31
const authenticationPromise = authenticate (
32
- db . cloud . options . databaseUrl ,
32
+ db . cloud . options ! . databaseUrl ,
33
33
user ,
34
34
dummyAuthDialog , // TODO: Fixthis!
35
- db . cloud . options . fetchTokens
35
+ db . cloud . options ! . fetchTokens
36
36
) ;
37
37
38
38
// Wait til all readwrite transactions have ended and there is nothing more to sync
@@ -44,7 +44,7 @@ export async function setCurrentUser(db: DexieCloudDB, user: AuthPersistedContex
44
44
const safeToChangeUser = outstandingTxAndUnsyncedChangesCombo . pipe (
45
45
filter (
46
46
( [ txSet , numOps ] ) =>
47
- makeArray ( txSet . values ( ) ) . every ( ( tx ) => tx . db !== db . backendDB ( ) ) &&
47
+ makeArray ( txSet . values ( ) ) . every ( ( tx ) => tx . db !== db . dx . backendDB ( ) ) &&
48
48
numOps === 0
49
49
)
50
50
) ;
0 commit comments