mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-17 12:56:05 +00:00
confirmed SSR support with Remix
This commit is contained in:
@@ -9,8 +9,9 @@ export const meta: MetaFunction = () => {
|
||||
|
||||
export const loader = async (args: LoaderFunctionArgs) => {
|
||||
const api = args.context.api as Api;
|
||||
const user = api.getAuthState().user;
|
||||
const { data } = await api.data.readMany("todos");
|
||||
return { data };
|
||||
return { data, user };
|
||||
};
|
||||
|
||||
export default function Index() {
|
||||
|
||||
@@ -6,6 +6,7 @@ import "bknd/dist/styles.css";
|
||||
export default function AdminPage() {
|
||||
const [loaded, setLoaded] = useState(false);
|
||||
useEffect(() => {
|
||||
if (typeof window === "undefined") return;
|
||||
setLoaded(true);
|
||||
}, []);
|
||||
if (!loaded) return null;
|
||||
|
||||
Reference in New Issue
Block a user