mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-22 22:49:45 +01:00
feat: redirect to /signup if user not logged in
This commit is contained in:
@@ -38,6 +38,8 @@ function initializeDatabase() {
|
||||
loadDefaultNotes(db);
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
return db;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,11 @@ if (process.env.NODE_ENV === "production") {
|
||||
console.log = () => {};
|
||||
}
|
||||
|
||||
initializeDatabase().then(() => {
|
||||
initializeDatabase().then(async (db) => {
|
||||
const isLoggedIn = !!(await db.user.getUser());
|
||||
if (!isLoggedIn && !window.location.pathname.startsWith("/signup"))
|
||||
window.location.replace("/signup");
|
||||
|
||||
import("react-dom").then(({ render }) => {
|
||||
import("./App").then(({ default: App }) => {
|
||||
render(<App />, document.getElementById("root"), async () => {
|
||||
|
||||
Reference in New Issue
Block a user