mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-20 01:37:23 +02:00
📈 Posthog package (#1431)
This commit is contained in:
parent
0fc7d0a0c8
commit
a5da319d82
43 changed files with 189 additions and 133 deletions
|
@ -1,4 +1,5 @@
|
|||
import languages from "@rallly/languages";
|
||||
import { withPostHog } from "@rallly/posthog/next/middleware";
|
||||
import { NextResponse } from "next/server";
|
||||
import withAuth from "next-auth/middleware";
|
||||
|
||||
|
@ -34,7 +35,11 @@ export const middleware = withAuth(
|
|||
|
||||
const res = NextResponse.rewrite(newUrl);
|
||||
|
||||
await initGuest(req, res);
|
||||
const jwt = await initGuest(req, res);
|
||||
|
||||
if (jwt?.sub) {
|
||||
await withPostHog(res, { distinctID: jwt.sub });
|
||||
}
|
||||
|
||||
return res;
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue