Skip to content

Commit 532ecd8

Browse files
ecwynejlengstorf
authored andcommitted
fix: simplify resolvers (#9)
Remove redundant Promise wrapper.
1 parent e090363 commit 532ecd8

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/resolvers.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
export default {
22
Query: {
3-
getLatestComic: (_, __, context) =>
4-
new Promise((resolve, reject) => {
5-
context
6-
.getLatestComic()
7-
.then(resolve)
8-
.catch(reject);
9-
}),
10-
getComicById: (_, { id }, context) =>
11-
new Promise((resolve, reject) => {
12-
context
13-
.getComicById(id)
14-
.then(resolve)
15-
.catch(reject);
16-
}),
3+
getLatestComic: (_, __, context) => context.getLatestComic(),
4+
getComicById: (_, { id }, context) => context.getComicById(id),
175
},
186
XKCD_Comic: {
197
// The link is often empty, so build one if it’s not returned.

0 commit comments

Comments
 (0)