Browse Source

upgrade miragejs/graphql

Klaudiusz Dembler 4 years ago
parent
commit
7608008d46
3 changed files with 9 additions and 13 deletions
  1. 1 1
      package.json
  2. 7 11
      src/mocking/server/resolvers.ts
  3. 1 1
      yarn.lock

+ 1 - 1
package.json

@@ -42,7 +42,7 @@
     "@apollo/client": "^3.1.1",
     "@emotion/babel-preset-css-prop": "^10.0.27",
     "@emotion/core": "^10.0.28",
-    "@miragejs/graphql": "^0.1.3",
+    "@miragejs/graphql": "^0.1.4",
     "@reach/router": "^1.3.3",
     "@storybook/addon-actions": "^5.3.17",
     "@storybook/addon-docs": "^5.3.17",

+ 7 - 11
src/mocking/server/resolvers.ts

@@ -34,12 +34,7 @@ export const videosResolver: QueryResolver<VideoQueryArgs> = (obj, args, context
   }
 
   const paginatedVideos = mirageGraphQLFieldResolver(obj, resolverArgs, context, info)
-  const allVideos = mirageGraphQLFieldResolver(obj, extraResolverArgs, context, info)
-
-  return {
-    ...paginatedVideos,
-    totalCount: allVideos.edges.length,
-  }
+  return paginatedVideos
 }
 
 export const featuredVideosResolver: QueryResolver = (...params) => {
@@ -48,12 +43,13 @@ export const featuredVideosResolver: QueryResolver = (...params) => {
 }
 
 export const channelsResolver: QueryResolver = (obj, args, context, info) => {
-  const paginatedChannels = mirageGraphQLFieldResolver(obj, args, context, info)
-  const allChannels = mirageGraphQLFieldResolver(obj, {}, context, info)
-  return {
-    ...paginatedChannels,
-    totalCount: allChannels.edges.length,
+  const resolverArgs = {
+    first: args.first,
+    after: args.after,
   }
+
+  const paginatedChannels = mirageGraphQLFieldResolver(obj, resolverArgs, context, info)
+  return paginatedChannels
 }
 
 // FIXME: This resolver is currently broken and returns the same result n times instead of the correct result.

+ 1 - 1
yarn.lock

@@ -1655,7 +1655,7 @@
   resolved "https://registry.yarnpkg.com/@mdx-js/util/-/util-1.6.18.tgz#c7563bf72cb4520b8b7100b64006a64be717e936"
   integrity sha512-axMe+NoLF55OlXPbhRn4GNCHcL1f5W3V3c0dWzg05S9JXm3Ecpxzxaht3g3vTP0dcqBL/yh/xCvzK0ZpO54Eug==
 
-"@miragejs/graphql@^0.1.3":
+"@miragejs/graphql@^0.1.4":
   version "0.1.4"
   resolved "https://registry.yarnpkg.com/@miragejs/graphql/-/graphql-0.1.4.tgz#0331bf9db402a8d55785ee2b3736e86b5c6940fb"
   integrity sha512-SabPcrBURJVBPaUpW5va2470/4juibfRs86iEtpHAh72qM5uREiwrU3d2BKksFE36/G9T+kiADQnKa5qdpuZ3Q==