feat(session): encrypt data and fix renewal (#38)
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import { json, type ActionFunctionArgs } from '@remix-run/cloudflare';
|
||||
import { handleWithAuth } from '~/lib/.server/login';
|
||||
import { getSession } from '~/lib/.server/sessions';
|
||||
import { getSessionData } from '~/lib/.server/sessions';
|
||||
import { sendEventInternal, type AnalyticsEvent } from '~/lib/analytics';
|
||||
|
||||
async function analyticsAction({ request, context }: ActionFunctionArgs) {
|
||||
const event: AnalyticsEvent = await request.json();
|
||||
const { session } = await getSession(request, context.cloudflare.env);
|
||||
const { success, error } = await sendEventInternal(session.data, event);
|
||||
const sessionData = await getSessionData(request, context.cloudflare.env);
|
||||
const { success, error } = await sendEventInternal(sessionData, event);
|
||||
|
||||
if (!success) {
|
||||
return json({ error }, { status: 500 });
|
||||
|
||||
Reference in New Issue
Block a user