Skip to content

Commit

Permalink
fix Strapi normalizer when response wa an empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
vladgrecu committed Sep 2, 2024
1 parent f91f4a0 commit 91e05e0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/strapi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ export const normalizeNestedAttributes = (
}

export const normalizeContent = (input: any): any => {

Check warning on line 62 in src/strapi/index.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type

Check warning on line 62 in src/strapi/index.ts

View workflow job for this annotation

GitHub Actions / test

Unexpected any. Specify a different type
if (Array.isArray(input)) {
return {
data: input.map(normalizeContent),
}
}

if (
input === null ||
input === undefined ||
Expand All @@ -68,12 +74,6 @@ export const normalizeContent = (input: any): any => {
return null
}

if (Array.isArray(input)) {
return {
data: input.map(normalizeContent),
}
}

let output = { ...input }

if (input.attributes) {
Expand Down

0 comments on commit 91e05e0

Please sign in to comment.