Исправил ошибки связанные с интеграцией с CRM
All checks were successful
Auto Deploy / deploy (push) Successful in 16s

This commit is contained in:
deonisii
2026-04-19 01:53:02 +03:00
parent 97b996edc8
commit 97237d85ad
2 changed files with 5 additions and 4 deletions

View File

@@ -43,6 +43,7 @@ ESPOCRM_LEAD_SOURCE=Web Site
```
Их можно положить в локальный `.env` или задать на сервере.
Пример есть в [`.env.example`](.env.example).
Установить зависимости:

View File

@@ -22,9 +22,9 @@ function normalizePhone(input: string) {
}
export async function POST(request: Request) {
const apiUrl = process.env.ESPOCRM_API_URL;
const apiKey = process.env.ESPOCRM_API_KEY;
const leadSource = process.env.ESPOCRM_LEAD_SOURCE || "Web Site";
const apiUrl = process.env.ESPOCRM_API_URL?.trim();
const apiKey = process.env.ESPOCRM_API_KEY?.trim();
const leadSource = process.env.ESPOCRM_LEAD_SOURCE?.trim() || "Web Site";
if (!apiUrl || !apiKey) {
console.error("EspoCRM env is not configured");
@@ -67,7 +67,7 @@ export async function POST(request: Request) {
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"x-api-key": apiKey,
"X-Api-Key": apiKey,
},
body: JSON.stringify(payload),
cache: "no-store",