fix(private-room): preserve payment return route

This commit is contained in:
2026-07-16 18:06:15 +08:00
parent b64a90f0e3
commit 4981de9b18
17 changed files with 280 additions and 21 deletions
+9
View File
@@ -1,4 +1,5 @@
import type { PayChannel } from "@/data/dto/payment";
import type { AppSubscriptionReturnTo } from "@/router/navigation-types";
export type PaymentSearchParamValue = string | string[] | undefined;
export type PaymentSearchParams = Record<string, PaymentSearchParamValue>;
@@ -21,6 +22,14 @@ export function parsePaymentPayChannel(
return channel === "ezpay" || channel === "stripe" ? channel : null;
}
export function parseSubscriptionReturnTo(
value: PaymentSearchParamValue,
): AppSubscriptionReturnTo {
const returnTo = getFirstPaymentSearchParam(value);
if (returnTo === "chat" || returnTo === "private-room") return returnTo;
return null;
}
export function parsePaymentReturnSearchParams(
searchParams: PaymentSearchParams,
): PaymentReturnSearchParams {