{"name":"@vespaiach/axios-fetch-adapter","version":"0.3.0","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.27.2","np":"^7.6.1","vite":"^2.8.0"},"peerDependencies":{"axios":">=0.26.0"},"gitHead":"a559e43f615077bcf3e619f7407d8471d345632e","_id":"@vespaiach/axios-fetch-adapter@0.3.0","_nodeVersion":"18.2.0","_npmVersion":"8.9.0","dist":{"integrity":"sha512-X3U9VANu+8R4Wu/77bAUiUSqgeTelDFZeJcGZDe63DiFcPI6onjrMWrG3py/N4Qf8qCU3YLq+wO2d8V6ftYcaw==","shasum":"abbd23478260a317165d0c52297306af9d39bb24","tarball":"http://registry-npm.ywwl.com/@vespaiach/axios-fetch-adapter/download/@vespaiach/axios-fetch-adapter-0.3.0.tgz","fileCount":7,"unpackedSize":10062,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBcQdnxozXzDQj6uO3OU3r6TWoIUxpJfIyaSXmnCrXh9AiAaLaW2Y69SsSO7iGemL8ZDRwdrLXrQ8tf/1fxYjB+Fgg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiiDGWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrxjA/8DV1EjY+mYoFQTkPw2jzqtY9i9DFKRkBH9m67fS8pzCMaixLK\r\nRDDs754hNFubj5hAAhfsAJxqV96Oc5SonxZsdBzmZckIspoOaT/3wAw4qbRr\r\nFpeE7zVef1w0mn17J3LNpesr2Zm5lX+lK6dPakgqH6W9r5RPL3Eh/aymnFQi\r\nvjAfjwndl5M0X8KssryWCj61172AAVbluyKSKja2lUB8zSa/n26464hubaQs\r\n394uuxOm1NEhV7IPSVuXLI+IQEeyNhvnb0KAAfyYxiuWd4ewL6sJ4ImoiRoF\r\ngO1jEpWfPDeL2MKzs7FlANqcpooNxIw+HSHFjqThjUVGs407kJ/FrDL/kb0b\r\nLxlZb3MUK/2VXmDrR1nvsG8pE0uvOVqc+2l+MxvtBZ9z7MsxFm+X0nQo9pay\r\nrew5ckloIxffdK467gKpncIBZpAvUA0ufxCT3IujkZJ+wVfXRMCLRQ5sSSic\r\nbxl9nhRZ1UUylnWHLtIKQcOMrvXdV2nJDXITiD+9uWbkvCOl7t85Z/5QW4JA\r\n5oO/vDE0u6A/VIuXKkZMMg3Ung74tctSrvc/hJGm5b+XyOudR0QC4hg/S0Fu\r\nVn133JguudnlyZnD1EZRyuyNMqONUv2CcLb0zsB8PLnVFy8K0zNuK0S0CGWA\r\nzHj6kTVl9XDZ3btWPw+dOk3TqA81B0JSONE=\r\n=LLNZ\r\n-----END PGP SIGNATURE-----\r\n","size":3973,"noattachment":false,"key":"/@vespaiach/axios-fetch-adapter/-/@vespaiach/axios-fetch-adapter-0.3.0.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.3.0_1653092758370_0.17645084070293082"},"_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":1653092758510,"_cnpm_publish_time":1653092758510,"dist-tags":{"latest":"0.3.1"}}