fixes bug with using old api identifier

This commit is contained in:
James
2020-04-21 14:04:49 -04:00
parent 91be273d64
commit f1e6e2fb0b
3 changed files with 6 additions and 5 deletions

View File

@@ -41,6 +41,7 @@ const find = async (args) => {
req: {
locale,
fallbackLocale,
payloadAPI,
},
} = options;
@@ -54,7 +55,7 @@ const find = async (args) => {
// Only allow depth override within REST.
// If allowed in GraphQL, it would break resolvers
// as a full object will be returned instead of an ID string
if (api === 'REST') {
if (payloadAPI === 'REST') {
if (depth && depth !== '0') {
optionsToExecute.options.autopopulate = {
maxDepth: parseInt(depth, 10),

View File

@@ -32,12 +32,12 @@ const findByID = async (args) => {
const {
depth,
api,
Model,
query,
req: {
locale,
fallbackLocale,
payloadAPI,
},
} = options;
@@ -48,7 +48,7 @@ const findByID = async (args) => {
// Only allow depth override within REST.
// If allowed in GraphQL, it would break resolvers
// as a full object will be returned instead of an ID string
if (api === 'REST') {
if (payloadAPI === 'REST') {
if (depth && depth !== '0') {
queryOptionsToExecute.options.autopopulate = {
maxDepth: parseInt(depth, 10),

View File

@@ -28,10 +28,10 @@ const findOne = async (args) => {
const {
depth,
api,
Model,
slug,
req: {
payloadAPI,
locale,
fallbackLocale,
},
@@ -44,7 +44,7 @@ const findOne = async (args) => {
// Only allow depth override within REST.
// If allowed in GraphQL, it would break resolvers
// as a full object will be returned instead of an ID string
if (api === 'REST') {
if (payloadAPI === 'REST') {
if (depth && depth !== '0') {
queryOptionsToExecute.options.autopopulate = {
maxDepth: parseInt(depth, 10),