Handle non-existant outfits better
Gotta remember to check the validity of IDs earlier than that lol!
This commit is contained in:
parent
9e2f9eab16
commit
e3ac9d06e5
2 changed files with 13 additions and 3 deletions
|
@ -70,11 +70,22 @@ const resolvers = {
|
||||||
},
|
},
|
||||||
creator: async ({ id }, _, { outfitLoader }) => {
|
creator: async ({ id }, _, { outfitLoader }) => {
|
||||||
const outfit = await outfitLoader.load(id);
|
const outfit = await outfitLoader.load(id);
|
||||||
return outfit.userId ? { id: outfit.userId } : null;
|
if (!outfit.userId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { id: outfit.userId };
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
Query: {
|
Query: {
|
||||||
outfit: (_, { id }) => ({ id }),
|
outfit: async (_, { id }, { outfitLoader }) => {
|
||||||
|
const outfit = await outfitLoader.load(id);
|
||||||
|
if (!outfit) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return { id };
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,6 @@ const resolvers = {
|
||||||
items: (...args) => resolvers.Pet.wornItems(...args),
|
items: (...args) => resolvers.Pet.wornItems(...args),
|
||||||
},
|
},
|
||||||
Query: {
|
Query: {
|
||||||
outfit: (_, { id }) => ({ id }),
|
|
||||||
petOnNeopetsDotCom: async (
|
petOnNeopetsDotCom: async (
|
||||||
_,
|
_,
|
||||||
{ petName },
|
{ petName },
|
||||||
|
|
Loading…
Reference in a new issue