fixed auth strategy toggle, updated astro/remix

This commit is contained in:
dswbx
2025-01-17 18:08:23 +01:00
parent baab70f9da
commit 7ddcfc89b4
9 changed files with 42 additions and 28 deletions

View File

@@ -5,6 +5,7 @@ import "bknd/dist/styles.css";
import { getApi } from "bknd/adapter/astro";
const api = getApi(Astro, { mode: "dynamic" });
await api.verifyAuth();
const user = api.getUser();
export const prerender = false;

View File

@@ -3,6 +3,8 @@ import { getApi } from "bknd/adapter/astro";
import Card from "../components/Card.astro";
import Layout from "../layouts/Layout.astro";
const api = getApi(Astro, { mode: "dynamic" });
await api.verifyAuth();
const { data } = await api.data.readMany("todos");
const user = api.getUser();

View File

@@ -7,9 +7,9 @@ export const meta: MetaFunction = () => {
export const loader = async (args: LoaderFunctionArgs) => {
const api = args.context.api;
const user = (await api.getVerifiedAuthState(true)).user;
await api.verifyAuth();
const { data } = await api.data.readMany("todos");
return { data, user };
return { data, user: api.getUser() };
};
export default function Index() {