You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code example on js-data-http guid simply does not work for me:
import{Container}from'js-data';import{HttpAdapter}from'js-data-http-node';consthttpAdapter=newHttpAdapter({basePath: 'https://mydomain.com'});conststore=newContainer();store.registerAdapter('http',httpAdapter,{'default': true});store.defineMapper('school');store.defineMapper('student');// GET /school/1store.find('school',1).then((school)=>{console.log('school');});
It throws error:
TypeError: adapter is not a function at dispatchRequest (/Users/ismail.niftaliev/Documents/demo/dummy_server/node_modules/axios/lib/core/dispatchRequest.js:59:10) at <anonymous> at process._tickCallback (internal/process/next_tick.js:189:7) at Function.Module.runMain (module.js:696:11) at startup (bootstrap_node.js:204:16) at bootstrap_node.js:625:3
The problem is in config object which you send to axios
you set adapter: 'http'
and axios first checks if config has an adapter then uses it if not uses default adapter and then calls it as a function, so while you set a string as a value for adapter it makes axios crazy.
Thanks!
The text was updated successfully, but these errors were encountered:
consthttpAdapter=newHttpAdapter({basePath: '[some url]',http: (config)=>{// axios will use it's default adapterconfig.adapter=null;returnaxios(config);}});
This code example on js-data-http guid simply does not work for me:
It throws error:
TypeError: adapter is not a function at dispatchRequest (/Users/ismail.niftaliev/Documents/demo/dummy_server/node_modules/axios/lib/core/dispatchRequest.js:59:10) at <anonymous> at process._tickCallback (internal/process/next_tick.js:189:7) at Function.Module.runMain (module.js:696:11) at startup (bootstrap_node.js:204:16) at bootstrap_node.js:625:3
The problem is in config object which you send to axios
you set
adapter: 'http'
and axios first checks if config has an adapter then uses it if not uses default adapter and then calls it as a function, so while you set a string as a value for adapter it makes axios crazy.
Thanks!
The text was updated successfully, but these errors were encountered: