Commit c6ed1d90 authored by ThinhNC's avatar ThinhNC

Merge develop into staging: fix URL_LIST 422 validation error

parents a3ede599 de6ad176
Pipeline #53747 passed with stage
in 1 minute and 25 seconds
......@@ -94,13 +94,16 @@ export function CrawlerTaskForm({ onSuccess }: CrawlerTaskFormProps) {
}, [isTemplateOpen]);
const onSubmit = (data: CreateCrawlJobInput) => {
const isUrlList = data.mode === "URL_LIST";
createJob(
{
startUrl: data.startUrl,
// Chỉ gửi startUrl khi không phải URL_LIST (tránh 422 từ backend validation)
...(isUrlList ? {} : { startUrl: data.startUrl || undefined }),
mode: data.mode,
maxDepth: data.maxDepth,
maxPages: data.maxPages,
urls: data.urls,
// Chỉ gửi urls khi là URL_LIST
urls: isUrlList ? data.urls : undefined,
priority: data.priority,
userAgent: data.userAgent || undefined,
cookie: data.cookie || undefined,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment