mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-18 03:20:35 -05:00
fix: zapier integration not able to pull past responses (#1627)
This commit is contained in:
@@ -1,14 +1,19 @@
|
||||
import { authenticateRequest } from "@/app/api/v1/auth";
|
||||
import { responses } from "@/app/lib/api/response";
|
||||
import { getResponsesByEnvironmentId } from "@formbricks/lib/response/service";
|
||||
import { authenticateRequest } from "@/app/api/v1/auth";
|
||||
import { DatabaseError } from "@formbricks/types/errors";
|
||||
import { NextRequest } from "next/server";
|
||||
|
||||
export async function GET(request: Request) {
|
||||
export async function GET(request: NextRequest) {
|
||||
const surveyId = request.nextUrl.searchParams.get("surveyId");
|
||||
try {
|
||||
const authentication = await authenticateRequest(request);
|
||||
if (!authentication) return responses.notAuthenticatedResponse();
|
||||
const responseArray = await getResponsesByEnvironmentId(authentication.environmentId!);
|
||||
return responses.successResponse(responseArray);
|
||||
let environmentResponses = await getResponsesByEnvironmentId(authentication.environmentId!);
|
||||
if (surveyId) {
|
||||
environmentResponses = environmentResponses.filter((response) => response.surveyId === surveyId);
|
||||
}
|
||||
return responses.successResponse(environmentResponses);
|
||||
} catch (error) {
|
||||
if (error instanceof DatabaseError) {
|
||||
return responses.badRequestResponse(error.message);
|
||||
|
||||
@@ -47,6 +47,11 @@ const nextConfig = {
|
||||
destination: "/api/v1/management/surveys",
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: "/api/v1/responses",
|
||||
destination: "/api/v1/management/responses",
|
||||
permanent: true,
|
||||
},
|
||||
{
|
||||
source: "/api/v1/me",
|
||||
destination: "/api/v1/management/me",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import global from "@/styles/global.css?inline";
|
||||
import preflight from "@/styles/preflight.css?inline";
|
||||
import editorCss from "../../../ui/Editor/stylesEditorFrontend.css?inline";
|
||||
import { isLight } from "@/lib/utils";
|
||||
|
||||
export const addStylesToDom = () => {
|
||||
if (document.getElementById("formbricks__css") === null) {
|
||||
@@ -19,6 +20,7 @@ export const addCustomThemeToDom = ({ brandColor }: { brandColor: string }) => {
|
||||
styleElement.innerHTML = `
|
||||
:root {
|
||||
--fb-brand-color: ${brandColor};
|
||||
${isLight(brandColor) ? "--fb-brand-text-color: black;" : "--fb-brand-text-color: white;"}
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(styleElement);
|
||||
|
||||
Reference in New Issue
Block a user