Ho-kage
Ho-kage
Explore posts from servers
SSolidJS
Created by Ho-kage on 11/10/2024 in #support
Action triggering revalidation without cookie
I am implementing an admin site which uses BetterAuth. When implementing an action it seems it tries to fetch fresh data (my createAsync call) but it fails my admin validation because the cookie doesn't seem to be present. Not quite sure how I get around this. The isAdmin function is shown below (it gets called by functions in a "use server" context).
import { getRequestEvent } from "solid-js/web";
import { auth } from "./auth";

export async function isAdmin() {
const event = getRequestEvent();

if (!event) {
return false;
}

console.log(event.request.headers.get("cookie"));
const session = await auth.api.getSession({ headers: event.request.headers });

if (!session) {
return false;
}

if (!session.session.userId) {
return false;
}

if (session.user.role !== "admin") {
return false;
}

return true;
}
import { getRequestEvent } from "solid-js/web";
import { auth } from "./auth";

export async function isAdmin() {
const event = getRequestEvent();

if (!event) {
return false;
}

console.log(event.request.headers.get("cookie"));
const session = await auth.api.getSession({ headers: event.request.headers });

if (!session) {
return false;
}

if (!session.session.userId) {
return false;
}

if (session.user.role !== "admin") {
return false;
}

return true;
}
3 replies
SSolidJS
Created by Ho-kage on 10/18/2024 in #support
SolidStart 1.0 and Deno 2.0
I think these two technologies sound very interesting together. Is there currently a happy path to trying them out?
17 replies
SSolidJS
Created by Ho-kage on 1/9/2023 in #support
Loading google fonts
I'm trying to load a google font with the <Link> component but it doesn't seem to be working <Link href="https://fonts.googleapis.com/css2?family=Cedarville+Cursive&family=Recursive:wght@300;400;500;600;700;800&display=swap" rel="stylesheet" /> It puts an <a> tag in the body with link=true as an attribute but nothing the font is not working.
93 replies