mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-06 05:40:02 -06:00
fix: survey meta data title added (#1669)
Co-authored-by: Johannes <johannes@formbricks.com>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { Metadata } from "next";
|
||||
import { authOptions } from "@formbricks/lib/authOptions";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { getAnalysisData } from "@/app/(app)/environments/[environmentId]/surveys/[surveyId]/(analysis)/data";
|
||||
import { authOptions } from "@formbricks/lib/authOptions";
|
||||
import { getSurvey } from "@formbricks/lib/survey/service";
|
||||
import { Metadata } from "next";
|
||||
import { getServerSession } from "next-auth";
|
||||
|
||||
type Props = {
|
||||
params: { surveyId: string; environmentId: string };
|
||||
@@ -9,11 +10,12 @@ type Props = {
|
||||
|
||||
export const generateMetadata = async ({ params }: Props): Promise<Metadata> => {
|
||||
const session = await getServerSession(authOptions);
|
||||
const survey = await getSurvey(params.surveyId);
|
||||
|
||||
if (session) {
|
||||
const { responseCount } = await getAnalysisData(params.surveyId, params.environmentId);
|
||||
return {
|
||||
title: `${responseCount} Responses`,
|
||||
title: `${responseCount} Responses | ${survey?.name} Results`,
|
||||
};
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -1,18 +1,25 @@
|
||||
export const revalidate = REVALIDATION_INTERVAL;
|
||||
import { getActionClasses } from "@formbricks/lib/actionClass/service";
|
||||
import { getAttributeClasses } from "@formbricks/lib/attributeClass/service";
|
||||
import { authOptions } from "@formbricks/lib/authOptions";
|
||||
import { REVALIDATION_INTERVAL } from "@formbricks/lib/constants";
|
||||
import { getEnvironment } from "@formbricks/lib/environment/service";
|
||||
import { getMembershipByUserIdTeamId } from "@formbricks/lib/membership/service";
|
||||
import { getAccessFlags } from "@formbricks/lib/membership/utils";
|
||||
import { getProductByEnvironmentId } from "@formbricks/lib/product/service";
|
||||
import { getResponseCountBySurveyId } from "@formbricks/lib/response/service";
|
||||
import { getSurvey } from "@formbricks/lib/survey/service";
|
||||
import { ErrorComponent } from "@formbricks/ui/ErrorComponent";
|
||||
import SurveyEditor from "./components/SurveyEditor";
|
||||
import { getTeamByEnvironmentId } from "@formbricks/lib/team/service";
|
||||
import { getMembershipByUserIdTeamId } from "@formbricks/lib/membership/service";
|
||||
import { ErrorComponent } from "@formbricks/ui/ErrorComponent";
|
||||
import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "@formbricks/lib/authOptions";
|
||||
import { getAccessFlags } from "@formbricks/lib/membership/utils";
|
||||
import SurveyEditor from "./components/SurveyEditor";
|
||||
|
||||
export const generateMetadata = async ({ params }) => {
|
||||
const survey = await getSurvey(params.surveyId);
|
||||
return {
|
||||
title: survey?.name ? `${survey?.name} | Editor` : "Editor",
|
||||
};
|
||||
};
|
||||
|
||||
export default async function SurveysEditPage({ params }) {
|
||||
const [survey, product, environment, actionClasses, attributeClasses, responseCount, team, session] =
|
||||
|
||||
Reference in New Issue
Block a user