mirror of
https://github.com/strapi/strapi.git
synced 2025-09-14 11:08:35 +00:00
Set the entry type only when the value is defined
This commit is contained in:
parent
e9fc37d03a
commit
4920c1fa76
@ -533,7 +533,10 @@ module.exports = {
|
|||||||
|
|
||||||
const entry = withRelated && withRelated.toJSON ? withRelated.toJSON() : withRelated;
|
const entry = withRelated && withRelated.toJSON ? withRelated.toJSON() : withRelated;
|
||||||
|
|
||||||
entry[association.alias]._type = _.upperFirst(association.model);
|
// Set the _type only when the value is defined
|
||||||
|
if (entry[association.alias]) {
|
||||||
|
entry[association.alias]._type = _.upperFirst(association.model);
|
||||||
|
}
|
||||||
|
|
||||||
return entry[association.alias];
|
return entry[association.alias];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user