fix: onboarding survey link (#2815)

This commit is contained in:
Dhruwang Jariwala
2024-06-26 12:06:55 +05:30
committed by GitHub
parent fc150f8860
commit cea5716c48
2 changed files with 14 additions and 4 deletions
@@ -9,9 +9,10 @@ import { TProductConfigChannel } from "@formbricks/types/product";
interface OnboardingSurveyProps {
organizationId: string;
channel: TProductConfigChannel;
userId: string;
}
export const OnboardingSurvey = ({ organizationId, channel }: OnboardingSurveyProps) => {
export const OnboardingSurvey = ({ organizationId, channel, userId }: OnboardingSurveyProps) => {
const [isIFrameVisible, setIsIFrameVisible] = useState(false);
const [fadeout, setFadeout] = useState(false);
const router = useRouter();
@@ -44,7 +45,7 @@ export const OnboardingSurvey = ({ organizationId, channel }: OnboardingSurveyPr
<div className="relative h-[60vh] w-[50vh] overflow-auto">
<iframe
onLoad={() => setIsIFrameVisible(true)}
src="https://app.formbricks.com/s/clxcwr22p0cwlpvgekzdab2x5?embed=true"
src={`https://app.formbricks.com/s/clxcwr22p0cwlpvgekzdab2x5?embed=true&userId=${userId}`}
className="absolute left-0 top-0 h-full w-full overflow-visible border-0"></iframe>
</div>
</div>
@@ -1,5 +1,7 @@
import { OnboardingSurvey } from "@/app/(app)/(onboarding)/organizations/[organizationId]/products/new/survey/components/OnboardingSurvey";
import { notFound } from "next/navigation";
import { getServerSession } from "next-auth";
import { notFound, redirect } from "next/navigation";
import { authOptions } from "@formbricks/lib/authOptions";
import { TProductConfigChannel, TProductConfigIndustry } from "@formbricks/types/product";
interface OnboardingSurveyPageProps {
@@ -13,11 +15,18 @@ interface OnboardingSurveyPageProps {
}
const Page = async ({ params, searchParams }: OnboardingSurveyPageProps) => {
const session = await getServerSession(authOptions);
if (!session) {
return redirect(`/auth/login`);
}
const channel = searchParams.channel;
const industry = searchParams.industry;
if (!channel || !industry) return notFound();
return <OnboardingSurvey organizationId={params.organizationId} channel={channel} />;
return (
<OnboardingSurvey organizationId={params.organizationId} channel={channel} userId={session.user.id} />
);
};
export default Page;