mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-15 07:25:25 +02:00
♻️ Upgrade to next-auth v5 (#1558)
This commit is contained in:
parent
17d386d905
commit
4b26dc50b3
53 changed files with 765 additions and 628 deletions
|
@ -1,4 +1,5 @@
|
|||
import { waitUntil } from "@vercel/functions";
|
||||
import type { NextRequest } from "next/server";
|
||||
import { PostHog } from "posthog-node";
|
||||
|
||||
function PostHogClient() {
|
||||
|
@ -14,10 +15,14 @@ function PostHogClient() {
|
|||
|
||||
export const posthog = PostHogClient();
|
||||
|
||||
export function posthogApiHandler() {
|
||||
try {
|
||||
waitUntil(Promise.all([posthog?.shutdown()]));
|
||||
} catch (error) {
|
||||
console.error("Failed to flush PostHog events:", error);
|
||||
}
|
||||
export function withPosthog(handler: (req: NextRequest) => Promise<Response>) {
|
||||
return async (req: NextRequest) => {
|
||||
const res = await handler(req);
|
||||
try {
|
||||
waitUntil(Promise.all([posthog?.shutdown()]));
|
||||
} catch (error) {
|
||||
console.error("Failed to flush PostHog events:", error);
|
||||
}
|
||||
return res;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue