@@ -645,7 +645,7 @@ function App() {
645645      //  every time we make an http request, this will run 1st before the request is made
646646      //  url, path and route are supplied to the interceptor
647647      //  request options can be modified and must be returned
648-       request:  async  (options , url , path , route ) =>  {
648+       request:  async  ({  options, url, path, route } ) =>  {
649649        if  (isExpired (token)) {
650650          token =  await  getNewToken ()
651651          setToken (token)
@@ -654,7 +654,7 @@ function App() {
654654        return  options
655655      },
656656      //  every time we make an http request, before getting the response back, this will run
657-       response:  async  (response ) =>  {
657+       response:  async  ({  response } ) =>  {
658658        //  unfortunately, because this is a JS Response object, we have to modify it directly.
659659        //  It shouldn't have any negative affect since this is getting reset on each request.
660660        const  res  =  response
@@ -879,10 +879,10 @@ const options = {
879879
880880  //  typically, `interceptors` would be added as an option to the `<Provider />`
881881  interceptors:  {
882-     request:  async  (options , url , path , route ) =>  { //  `async` is not required
882+     request:  async  ({  options, url, path, route } ) =>  { //  `async` is not required
883883      return  options //  returning the `options` is important
884884    },
885-     response:  async  (response ) =>  {
885+     response:  async  ({  response } ) =>  {
886886      //  note: `response.data` is equivalent to `await response.json()`
887887      return  response //  returning the `response` is important
888888    }
@@ -1057,12 +1057,6 @@ Todos
10571057    //  I don't really like this solution though.
10581058    //  Another solution is to only allow the `cache` option with the `<Provider cache={new Map()} />`
10591059    cache:  new  Map (),
1060-     interceptors:  {
1061-       //  I think it's more scalable/clean to have this as an object.
1062-       //  What if we only need the `route` and `options`?
1063-       request:  async  ({ options, url, path, route }) =>  {},
1064-       response:  async  ({ response }) =>  {}
1065-     },
10661060    //  these will be the exact same ones as Apollo's
10671061    cachePolicy:  ' cache-and-network'  , ' network-only'  , ' cache-only'  , ' no-cache'   //  'cache-first'
10681062    //  potential idea to fetch on server instead of just having `loading` state. Not sure if this is a good idea though
0 commit comments