mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-18 03:20:35 -05:00
fix: validations in integrations (#3238)
This commit is contained in:
committed by
GitHub
parent
5035e3db9d
commit
87c584add8
@@ -232,7 +232,7 @@ export const AddIntegrationModal = ({
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<Label htmlFor="Surveys">Questions</Label>
|
||||
<div className="mt-1 max-h-[15vh] overflow-y-auto rounded-lg border border-slate-200">
|
||||
<div className="mt-1 max-h-[15vh] overflow-y-auto overflow-x-hidden rounded-lg border border-slate-200">
|
||||
<div className="grid content-center rounded-lg bg-slate-50 p-3 text-left text-sm text-slate-900">
|
||||
{replaceHeadlineRecall(selectedSurvey, "default", attributeClasses)?.questions.map(
|
||||
(question) => (
|
||||
|
||||
@@ -11,6 +11,19 @@ import { ITEMS_PER_PAGE } from "../constants";
|
||||
import { validateInputs } from "../utils/validate";
|
||||
import { integrationCache } from "./cache";
|
||||
|
||||
const transformIntegration = (integration: TIntegration): TIntegration => {
|
||||
return {
|
||||
...integration,
|
||||
config: {
|
||||
...integration.config,
|
||||
data: integration.config.data.map((data) => ({
|
||||
...data,
|
||||
createdAt: new Date(data.createdAt),
|
||||
})),
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const createOrUpdateIntegration = async (
|
||||
environmentId: string,
|
||||
integrationData: TIntegrationInput
|
||||
@@ -75,7 +88,9 @@ export const getIntegrations = reactCache(
|
||||
{
|
||||
tags: [integrationCache.tag.byEnvironmentId(environmentId)],
|
||||
}
|
||||
)()
|
||||
)().then((cachedIntegration) => {
|
||||
return cachedIntegration.map((integration) => transformIntegration(integration));
|
||||
})
|
||||
);
|
||||
|
||||
export const getIntegration = reactCache(
|
||||
@@ -130,7 +145,11 @@ export const getIntegrationByType = reactCache(
|
||||
{
|
||||
tags: [integrationCache.tag.byEnvironmentIdAndType(environmentId, type)],
|
||||
}
|
||||
)()
|
||||
)().then((cachedIntegration) => {
|
||||
if (cachedIntegration) {
|
||||
return transformIntegration(cachedIntegration);
|
||||
} else return null;
|
||||
})
|
||||
);
|
||||
|
||||
export const deleteIntegration = async (integrationId: string): Promise<TIntegration> => {
|
||||
|
||||
Reference in New Issue
Block a user