Commit de6ad176 authored by ThinhNC's avatar ThinhNC

Merge fix/export-custom-filename into develop: fix URL_LIST 422 validation error

parents 1e45855c 306919af
Pipeline #53746 passed with stage
in 1 minute and 26 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