mirror of
https://github.com/documenso/documenso.git
synced 2025-11-19 19:21:39 +10:00
fix: minimal vite config
This commit is contained in:
@ -1,9 +1,30 @@
|
||||
import { getContext } from 'hono/context-storage';
|
||||
import { redirect } from 'react-router';
|
||||
import type { HonoEnv } from 'server';
|
||||
import type { AppContext } from 'server/context';
|
||||
|
||||
import type { AppSession } from '@documenso/lib/client-only/providers/session';
|
||||
|
||||
/**
|
||||
* Get the full context passed to the loader.
|
||||
*
|
||||
* @returns The full app context.
|
||||
*/
|
||||
export const getOptionalLoaderContext = (): AppContext => {
|
||||
const { context } = getContext<HonoEnv>().var;
|
||||
return context;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the session extracted from the app context.
|
||||
*
|
||||
* @returns The session, or null if not authenticated.
|
||||
*/
|
||||
export const getOptionalLoaderSession = (): AppSession | null => {
|
||||
const { context } = getContext<HonoEnv>().var;
|
||||
return context.session;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the session context or throws a redirect to signin if it is not present.
|
||||
*/
|
||||
@ -17,11 +38,6 @@ export const getLoaderSession = (): AppSession => {
|
||||
return session;
|
||||
};
|
||||
|
||||
export const getOptionalLoaderSession = (): AppSession | null => {
|
||||
const { context } = getContext<HonoEnv>().var;
|
||||
return context.session;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the team session context or throws a redirect to signin if it is not present.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user