fix session update and utm redirect

This commit is contained in:
dev.daminik00 2025-10-08 00:19:40 +02:00
parent b31b42a57d
commit 6d7bbc766a
2 changed files with 20 additions and 3 deletions

View File

@ -39,10 +39,12 @@ interface FunnelRootPageProps {
params: Promise<{ params: Promise<{
funnelId: string; funnelId: string;
}>; }>;
searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
} }
export default async function FunnelRootPage({ params }: FunnelRootPageProps) { export default async function FunnelRootPage({ params, searchParams }: FunnelRootPageProps) {
const { funnelId } = await params; const { funnelId } = await params;
const queryParams = await searchParams;
let funnel: FunnelDefinition | null = null; let funnel: FunnelDefinition | null = null;
@ -66,5 +68,19 @@ export default async function FunnelRootPage({ params }: FunnelRootPageProps) {
redirect("/"); redirect("/");
} }
redirect(`/${funnel.meta.id}/${firstScreenId}`); // Сохраняем query параметры при редиректе
const queryString = new URLSearchParams(
Object.entries(queryParams).reduce((acc, [key, value]) => {
if (value !== undefined) {
acc[key] = Array.isArray(value) ? value[0] : value;
}
return acc;
}, {} as Record<string, string>)
).toString();
const redirectUrl = queryString
? `/${funnel.meta.id}/${firstScreenId}?${queryString}`
: `/${funnel.meta.id}/${firstScreenId}`;
redirect(redirectUrl);
} }

View File

@ -22,9 +22,10 @@ export const createSession = async (
export const updateSession = async ( export const updateSession = async (
payload: IUpdateSessionRequest payload: IUpdateSessionRequest
): Promise<IUpdateSessionResponse> => { ): Promise<IUpdateSessionResponse> => {
// Отправляем только data без вложенности
return http.patch<IUpdateSessionResponse>( return http.patch<IUpdateSessionResponse>(
API_ROUTES.session(payload.sessionId), API_ROUTES.session(payload.sessionId),
payload, payload.data,
{ {
tags: ["session", "update"], tags: ["session", "update"],
schema: UpdateSessionResponseSchema, schema: UpdateSessionResponseSchema,