✨ first version
CI / test (push) Successful in 5m3s
CI / build (push) Successful in 2m42s
CI / deploy (push) Successful in 16s

This commit is contained in:
2026-08-28 10:12:02 +02:00
parent 55a51a521d
commit cde6899469
70 changed files with 12778 additions and 483 deletions
+8 -3
View File
@@ -1,10 +1,15 @@
import { createServerFn } from '@tanstack/react-start'
import { createServerFn, createServerOnlyFn } from '@tanstack/react-start'
import { getRequest } from '@tanstack/react-start/server'
export async function getStaffSession() {
// `staff.index.tsx` and friends import `getCurrentStaffUser` from this module for
// their `beforeLoad` checks, which pulls the whole file into the client bundle too.
// `createServerOnlyFn` tells the compiler this closure (and the server-only
// `getRequest` import it uses) can be stripped from that client bundle instead of
// dragging the Postgres driver into the browser.
export const getStaffSession = createServerOnlyFn(async function getStaffSession() {
const { getAuth } = await import('#/lib/auth-instance')
return getAuth().api.getSession({ headers: getRequest().headers })
}
})
export async function requireStaffSession() {
const session = await getStaffSession()