(c: Context)
| 3 | import { getClientEnv, getServerEnv } from "~/env.server" |
| 4 | |
| 5 | export const getLoadContext = async (c: Context) => { |
| 6 | // get the locale from the context |
| 7 | const locale = i18next.getLocale(c) |
| 8 | // get t function for the default namespace |
| 9 | const t = await i18next.getFixedT(c) |
| 10 | // get the server environment |
| 11 | const env = getServerEnv() |
| 12 | |
| 13 | return { |
| 14 | lang: locale, |
| 15 | t, |
| 16 | isProductionDeployment: env.APP_ENV === "production", |
| 17 | env, |
| 18 | clientEnv: getClientEnv(), |
| 19 | // We do not add this to AppLoadContext type because it's not needed in the loaders, but it's used above to handle requests |
| 20 | body: c.body, |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | interface LoadContext extends Awaited<ReturnType<typeof getLoadContext>> {} |
| 25 |
nothing calls this directly
no test coverage detected
searching dependent graphs…