* refactor: move to tanstack start * refactor: auth flow & volumes * refactor: repo & snapshot details * refactor: backups, create repo, volumes * refactor: create volume & restore snapshot * refactor: notifications * refactor: settings * refactor: breadcrumbs * fix: ts issues * refactor: prod deployment * fix: import css production * refactor: nitro build * refactor: winston -> consola * fix: memory leak is sse events cleanup * fix: cli usage * chore: remove rr routes file * refactor: pr feedbacks * refactor: patch api client to have a global client per call * refactor: pr feedbacks * fix(dockerfile): add explicit port * fix(e2e): healthcheck under /api
17 lines
512 B
TypeScript
17 lines
512 B
TypeScript
import { createMiddleware } from "@tanstack/react-start";
|
|
import { getRequestHeaders } from "@tanstack/react-start/server";
|
|
import {
|
|
createRequestClient,
|
|
runWithRequestClient,
|
|
} from "~/lib/request-client";
|
|
|
|
export const apiClientMiddleware = createMiddleware().server(async ({ next, request }) => {
|
|
const client = createRequestClient({
|
|
baseUrl: new URL(request.url).origin,
|
|
headers: {
|
|
cookie: getRequestHeaders().get("cookie") ?? "",
|
|
},
|
|
});
|
|
|
|
return runWithRequestClient(client, () => next());
|
|
});
|