fixing spit convert

This commit is contained in:
hanif salafi 2025-07-20 16:10:19 +07:00
parent 007a6d9eec
commit f639a827d4
1 changed files with 2 additions and 2 deletions

View File

@ -282,7 +282,7 @@ export default function FormConvertSPIT() {
const response = await getTagsBySubCategoryId(categoryId); const response = await getTagsBySubCategoryId(categoryId);
if (response?.data?.data?.length > 0) { if (response?.data?.data?.length > 0) {
// Extract tag names from the response objects // Extract tag names from the response objects
const apiTags = response?.data?.data?.map((tag: any) => tag.tagName || tag.name || tag); const apiTags = response?.data?.data?.map((tag: any) => tag.tagName);
// Merge with existing tags, ensuring uniqueness // Merge with existing tags, ensuring uniqueness
const tagsMerge = Array.from(new Set([...tags, ...apiTags])); const tagsMerge = Array.from(new Set([...tags, ...apiTags]));
setTags(tagsMerge); setTags(tagsMerge);
@ -328,7 +328,7 @@ export default function FormConvertSPIT() {
// Set content tags and merge with category tags // Set content tags and merge with category tags
if (details.contentTag) { if (details.contentTag) {
const contentTags = details.contentTag.split(",").map((tag: string) => tag.trim()); const contentTags = details.contentTag.split(",").map((tag: string) => tag.trim());
setTags(prev => [...new Set([...prev, ...contentTags])]); setTags(prev => Array.from(new Set([...prev, ...contentTags])));
} }
} catch (error) { } catch (error) {
console.error("Failed to load detail:", error); console.error("Failed to load detail:", error);