{"name":"@vespaiach/axios-fetch-adapter","version":"0.2.2","description":"Fetch adapter for axios","main":"index.js","module":"index.js","types":"index.d.ts","scripts":{"release":"np","test":"echo done","dev":"vite"},"repository":{"type":"git","url":"git+https://github.com/vespaiach/axios-fetch-adapter.git"},"keywords":["axios","adapter","fetch"],"author":{"name":"nta.toan@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/vespaiach/axios-fetch-adapter/issues"},"homepage":"https://github.com/vespaiach/axios-fetch-adapter#readme","devDependencies":{"axios":"^0.26.1","np":"^7.4.0","vite":"^2.8.0"},"peerDependencies":{"axios":"^0.26.1"},"gitHead":"8f8751c6bddff50c12fb068b13973c5702ed9398","_id":"@vespaiach/axios-fetch-adapter@0.2.2","_nodeVersion":"16.5.0","_npmVersion":"7.19.1","dist":{"integrity":"sha512-kX9PK/TKTaN3XxU6LW8hPJSwZ4cU8yeAEBsjFjm4qw+clXjS45Hc6lYIguzsDKwBTNVtF3PG0JVt0y/vYmMeWg==","shasum":"2090ba86f8c1cccc775ecf42658110d6aac02e49","tarball":"http://registry-npm.ywwl.com/@vespaiach/axios-fetch-adapter/download/@vespaiach/axios-fetch-adapter-0.2.2.tgz","fileCount":7,"unpackedSize":7976,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICoqEzHy3CmoxqWQ9lX8FRHix4FrpaFnKxQVEdz3bfhRAiEA+dKMWbhvd/KslvKJFlqJ/rWm1AYkvQ+/OasPnfG9WpU="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiR2l9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoU6hAApDU+/d7pCXJmdlVQE+09klJqQBk+gOBfv4zMoIiijgTQjInO\r\nFwgpuNrpFvzBweuyt4WXoZv1RjBWw2iaRcnOm2TKrr4VICiNjHS8DdBFhf/g\r\ny2gl1GUYc54AXAMn+90QPU2+UxfLGWksE42rbi3vfhRSCRgeWMTcT4i1ELMn\r\nIaLWsG+XnPgCdGXUDQIMhao30paSXtpXX2IFQtJK3a9lQccXSrdT41j/nMY/\r\n31ZwlHaJ9UYSX0rRNAi85uZYd+q6RDxz/Ftlnals1YTCmQmNyZynURYPKbmj\r\nX2/OjCk/SRU1jYiNAtCFk6jTN3Zp0gdp53d1O1qYcORs8iJjHF7YsmX9ZfvD\r\nJAM0g7ex12wN804h6mJFcostAvFF3Rl5ij6/lZjP6HxtVPnn+5d9YesPZ52d\r\nMrFbABa9Y1NZFbP6QQy56XP4AVdsuDartzNq9SEL5qYcQPdcwNJg2pqfiA+r\r\nXClhuyCIpKzyyn5Gj/toXqA1sgAsIh9UbAIy7nevHWzQccAhulSiPo/pttyR\r\ncx5vwU9VgDPY6DF8pEiyTk7nhwo/irEg6j4WMfDoDgbEi4/YvQCoEZeFPwTm\r\nE1fWNG7nzfug7BPDambab8BeaLGusi8qnX9Z4cWxmpRNKyBe+WQulv0tfBc3\r\nLZhYSxn5sfEcVKauRZWa57ItMvxw2vbJxWQ=\r\n=io+W\r\n-----END PGP SIGNATURE-----\r\n","size":3417,"noattachment":false,"key":"/@vespaiach/axios-fetch-adapter/-/@vespaiach/axios-fetch-adapter-0.2.2.tgz"},"_npmUser":{"name":"vespaiach","email":"nta.toan@gmail.com"},"directories":{},"maintainers":[{"name":"vespaiach","email":"nta.toan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/axios-fetch-adapter_0.2.2_1648847229290_0.45262089244284653"},"_hasShrinkwrap":false,"readme":"# Why\r\n\r\nI'm going to adopt PWA to my web applications and those web apps are heavily using Axios with the default XMLHTTPRequest adapter. Hence, I have to switch to Fetch adapter; However, Axios doesn't have an adapter for fetch API for now. So I write one to use while waiting for an offical one from Axios.\r\n\r\n# Installation and Usage\r\n\r\nYou can install the adapter directly from this repository URL or feel free to copy its source code to your project.\r\n\r\n``` sh\r\nnpm install axios\r\nnpm install @vespaiach/axios-fetch-adapter\r\n```\r\n\r\nThere are two ways to use it:\r\n\r\n1.  Create a new instance of Axios and pass this adapter in configuration\r\n\r\n``` js\r\nconst instance = axios.create({\r\n  baseURL: 'https://some-domain.com/api/',\r\n  timeout: 1000,\r\n  adapter: fetchAdapter\r\n  ....\r\n});\r\n```\r\n\r\n2.  Pass this adapter in each of request\r\n\r\n``` js\r\naxios.request({\r\n  url: '/user',\r\n  method: 'get',\r\n  adapter: fetchAdapter\r\n  ...\r\n})\r\n```\r\n\r\n3.  Use with FormData \r\n\r\n``` js\r\naxios.request({\r\n  url: '/user',\r\n  method: 'post',\r\n  adapter: fetchAdapter\r\n  data: new FormData(formId)\r\n  ...\r\n})\r\n```\r\n\r\n# Note\r\n\r\n- Since, this adapter relies on fetch API so it won't work in Node environment\r\n","publish_time":1648847229496,"_cnpm_publish_time":1648847229496,"dist-tags":{"latest":"0.3.1"}}