mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-10-01 15:48:23 -05:00
Move app to apps/web-react in pnpm workspace layout
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import type { MiddlewareFunction } from "react-router";
|
||||
import { viewerTimezoneAsyncLocalStorage } from "./timezone-context.server";
|
||||
import { viewerTimezoneFromCookieHeader } from "./timezone-cookie";
|
||||
|
||||
/**
|
||||
* Resolves the viewer's timezone from their cookie and makes it available to
|
||||
* loaders via `getViewerTimezone` for the duration of the request.
|
||||
*/
|
||||
export const timezoneMiddleware: MiddlewareFunction<Response> = (
|
||||
{ request },
|
||||
next,
|
||||
) =>
|
||||
viewerTimezoneAsyncLocalStorage.run(
|
||||
{ timezone: viewerTimezoneFromCookieHeader(request.headers.get("Cookie")) },
|
||||
() => next(),
|
||||
);
|
||||
Reference in New Issue
Block a user