mirror of
https://github.com/strapi/strapi.git
synced 2025-10-13 00:52:54 +00:00
fix: update route serialization utility to handle non-array values correctly (#24245)
This commit is contained in:
parent
1b486371fb
commit
acdb68cd97
@ -20,11 +20,11 @@ export const sanitizeRoutesArrayForSerialization = (routes: unknown[]): Record<s
|
|||||||
|
|
||||||
export const sanitizeRoutesMapForSerialization = (
|
export const sanitizeRoutesMapForSerialization = (
|
||||||
map: Record<string, unknown[]>
|
map: Record<string, unknown[]>
|
||||||
): Record<string, Record<string, unknown>[]> =>
|
): Record<string, unknown> =>
|
||||||
Object.entries(map).reduce(
|
Object.entries(map).reduce(
|
||||||
(acc, [key, value]) => ({
|
(acc, [key, value]) => ({
|
||||||
...acc,
|
...acc,
|
||||||
...(Array.isArray(value) && { [key]: sanitizeRoutesArrayForSerialization(value) }),
|
[key]: Array.isArray(value) ? sanitizeRoutesArrayForSerialization(value) : value,
|
||||||
}),
|
}),
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user