Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: redirect all routes to signup on first launch

thecodrrf657398ccfa1
diff --git a/apps/web/src/index.js b/apps/web/src/index.js
index 3032dc9c9..6215ea0e1 100644
--- a/apps/web/src/index.js
+++ b/apps/web/src/index.js
@@ -24,19 +24,20 @@ const ROUTES = {
// component: () => import("./views/auth"),
// props: { type: "recover" },
// },
- "/": { component: () => import("./app"), props: {} },
+ default: { component: () => import("./app"), props: {} },
};
function getRoute() {
const path = getCurrentPath();
- if (!ROUTES[path]) {
- return shouldSkipInitiation() ? ROUTES["/"] : ROUTES["/signup"];
+ if (!shouldSkipInitiation() && !ROUTES[path]) {
+ window.history.replaceState({}, null, "/signup");
+ return ROUTES["/signup"];
}
- return ROUTES[path];
+ return ROUTES[path] || ROUTES.default;
}
const route = getRoute();
-route.component().then(({ default: Component }) => {
+route?.component()?.then(({ default: Component }) => {
render(
<Component {...route.props} />,
document.getElementById("root"),