fix(subscription): return chat paywalls after payment

This commit is contained in:
2026-06-25 10:20:13 +08:00
parent 9555a173b5
commit c8f0827e40
7 changed files with 58 additions and 14 deletions
+8 -2
View File
@@ -30,8 +30,14 @@ export type StaticRoute = (typeof ROUTES)[keyof typeof ROUTES];
export const ROUTE_BUILDERS = {
chatDeviceId: (deviceId: string): `/chat/deviceid/${string}` =>
`/chat/deviceid/${encodeURIComponent(deviceId)}` as const,
subscription: (type: "vip" | "voice"): `/subscription?type=${string}` =>
`${ROUTES.subscription}?type=${encodeURIComponent(type)}` as const,
subscription: (
type: "vip" | "voice",
options: { returnTo?: "chat" } = {},
): `/subscription?${string}` => {
const params = new URLSearchParams({ type });
if (options.returnTo) params.set("returnTo", options.returnTo);
return `${ROUTES.subscription}?${params.toString()}` as const;
},
authWithRedirect: (redirectTo: string): `/auth?redirect=${string}` =>
`${ROUTES.auth}?redirect=${encodeURIComponent(redirectTo)}` as const,
} as const;