fix: person update endpoint not working due to caching issue (#1666)

This commit is contained in:
Matti Nannt
2023-11-21 16:02:01 +01:00
committed by GitHub
parent 9ad5d4ec5c
commit 8b77494e32
3 changed files with 6 additions and 59 deletions
@@ -1,6 +1,6 @@
import { responses } from "@/app/lib/api/response";
import { transformErrorToDetails } from "@/app/lib/api/validator";
import { getPersonByUserId, updatePerson } from "@formbricks/lib/person/service";
import { createPerson, getPersonByUserId, updatePerson } from "@formbricks/lib/person/service";
import { ZPersonUpdateInput } from "@formbricks/types/people";
import { NextResponse } from "next/server";
@@ -31,10 +31,12 @@ export async function POST(req: Request, context: Context): Promise<NextResponse
);
}
const person = await getPersonByUserId(environmentId, userId);
let person = await getPersonByUserId(environmentId, userId);
if (!person) {
return responses.notFoundResponse("PersonByUserId", userId, true);
// return responses.notFoundResponse("PersonByUserId", userId, true);
// HOTFIX: create person if not found to work around caching issue
person = await createPerson(environmentId, userId);
}
await updatePerson(person.id, inputValidation.data);
-55
View File
@@ -1,55 +0,0 @@
# @formbricks/js
## 1.1.4
### Patch Changes
- 24f5796c: various improvements & bugfixes
## 1.1.3
### Patch Changes
- d1172831: Multiple bugfixes and performance improvements
## 1.1.0
### Minor Changes
- e46b0588: Multiple bugfixes and performance improvements
## 1.0.6
### Patch Changes
- 8efb1054: Introduce response queue for instant question transitions
## 1.0.5
### Patch Changes
- bea1f993: Fix submit error in multiple choice questions
## 1.0.4
### Patch Changes
- 01523393: Convert all attributes and userIds to string in formbricks-js
## 1.0.3
### Patch Changes
- 3dde021c: Release version 1.0.2
## 1.0.2
### Patch Changes
- a1b447ca: Increase z-index to 999999 to increase compatibility with more websites
## 1.0.1
### Patch Changes
- 3d0d633b: Fix new Session event not triggered every time a new session is created
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@formbricks/js",
"license": "MIT",
"version": "1.2.2",
"version": "1.2.3",
"description": "Formbricks-js allows you to connect your app to Formbricks, display surveys and trigger events.",
"keywords": [
"Formbricks",