diff --git a/app/src/app.tsx b/app/src/app.tsx index 4b1b5a9..e01a788 100644 --- a/app/src/app.tsx +++ b/app/src/app.tsx @@ -2,6 +2,7 @@ import "./app.css"; import { createSignal } from "solid-js"; import Index from "./pages/index"; import Page from "./pages/page"; +import random from "./helpers/random"; const routes = { "/": Index, @@ -36,7 +37,9 @@ export default () => { 📄 - {routes[pathname()] ?? } + {routes[pathname()] ?? ( + + )} ); }; diff --git a/app/src/helpers/random.ts b/app/src/helpers/random.ts new file mode 100644 index 0000000..94f9e8e --- /dev/null +++ b/app/src/helpers/random.ts @@ -0,0 +1,5 @@ +function random(): number { + return window.crypto.getRandomValues(new Uint16Array(1))[0]!; +} + +export default random; diff --git a/app/src/pages/page.tsx b/app/src/pages/page.tsx index 5ef43e2..493a9d3 100644 --- a/app/src/pages/page.tsx +++ b/app/src/pages/page.tsx @@ -37,6 +37,7 @@ export default (props: { id: number }) => { if (await updatePage(id, content)) { unblock(); refetch(); + window.history.replaceState({}, "", `/${id}`); } }, intervalMs