This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { jwtVerify, SignJWT, type JWTPayload } from "jose"; | |
// your env variables | |
import { env } from "@server/env"; | |
// your context and cookie utils | |
import type { Context } from "hono"; | |
import { getCookie, setCookie } from "hono/cookie"; | |
import type { CookieOptions } from "hono/utils/cookie"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type RootContext = { | |
store: JotaiStore; | |
}; | |
export const Route = createRootRouteWithContext<RootContext>()({ | |
component: Root, | |
}); | |
export default function Root() { | |
return <Outlet />; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @see https://github.com/tanstack/router/discussions/2567 | |
*/ | |
await navigate({ | |
to: "/", | |
invalidate: false, | |
clearCache: { | |
before: true, | |
after: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const useParamsWithTypeConversion = < | |
T extends { [key: string]: (v: string | string[]) => number | boolean | string } | |
>( | |
conversions: T | |
) => { | |
const params = useParams() | |
const convertedParams = {} as { [K in keyof T]: ReturnType<T[K]> } | |
for (const [key, conversion] of Object.entries(conversions)) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// actions.ts | |
export const addUpdateProject = privateActionClient | |
.metadata({ actionName: 'addUpdateProject', description: 'Add or update a project.' }) | |
.schema(projectsInsertSchema) | |
.action( | |
async ({ parsedInput, ctx }) => { | |
const { id, ...rest } = parsedInput | |
const [{ insertId }] = await ctx.db | |
.insert(projects) |