Fix session replica behaviour (merge with session)
The harder-to-refactor parts are the places where exists/username/token are called within a React component. However, `resetAndRedirect` and `store` are already called from async contexts, so adding an `await` is simple. This thus merges the logic, keeping localStorage for the components to call, but making sure reset/store behaviour works correctly for the replica.
This commit is contained in:
parent
4e44b034bd
commit
8ccfa5c3fb
15 changed files with 43 additions and 78 deletions
|
@ -1,6 +1,5 @@
|
|||
import Dexie from "dexie";
|
||||
import session from "./Session";
|
||||
import sessionReplica from "./SessionReplica";
|
||||
|
||||
// Uses Dexie.js
|
||||
// https://dexie.org/docs/API-Reference#quick-reference
|
||||
|
@ -23,7 +22,7 @@ const createDatabase = (username) => {
|
|||
};
|
||||
|
||||
export const dbAsync = async () => {
|
||||
const username = await sessionReplica.username();
|
||||
const username = await session.usernameAsync();
|
||||
return createDatabase(username);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue