{"name":"@vespaiach/axios-fetch-adapter","version":"0.2.0","description":"Fetch adapter for axios","main":"index.js","module":"index.js","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.21.1"},"gitHead":"20f5629242f09d7a1ed8af34010798e846bd8360","_id":"@vespaiach/axios-fetch-adapter@0.2.0","_nodeVersion":"16.5.0","_npmVersion":"7.19.1","dist":{"integrity":"sha512-F9nCbK+bkRklf0/2kKX0sbNi7dxc04OGgQbYx0ExS6IB2GNS4U4/7ICzatlQIkg01MG9aB5H65lT6Xlzuut2dw==","shasum":"b212b785a49a7dc2722ed4a63aaaf92eceaf2b45","tarball":"http://registry-npm.ywwl.com/@vespaiach/axios-fetch-adapter/download/@vespaiach/axios-fetch-adapter-0.2.0.tgz","fileCount":6,"unpackedSize":7810,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiPL62ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqlSQ//VSdBofNIOcbGNEQVadtNwg4vWqo1Hr1opgggGgERVYnq+GPG\r\nETbtDMiDUSdUaFf72bvo0UccK8vw1Hbnsa37KulFvkxBHhKc8Qj4Oj7uNfv1\r\nQjRjVMMBbxqbBoHLwXVW+nH7lbzCyepbJq+nHPD2vcypXvULiCQrKGa0uAdz\r\nCapHFckEtRe89IQeQXPXxn1kOm150BCiVzL4ll16n5GyQm1ocH9gJd5TbOBa\r\nNvlohectii9sFaD1w0O8VKuVoYu3KznqEqsrbxfIIjqIvTaSJJcwnStVqXLj\r\nKjuexndggEsnP+uFgNCUURGO+B4i5h05hbLMIGkKOAMv7/frYt+VLZ674f9+\r\nLvgQIvc5vSQ12ZveW4s5DcAGuRxAULYksaGleH7lJb6833FJR+dhPkSqJiVB\r\nJbyqD+t+ws9Bvt6K4oYMbjEjaU3cg1iEtcUUn1O7dH2KQKNJwack3sB2Bq6F\r\nHsAoYY9ThlAQ3HnasrzSpegGDr3+4Zrt1E+B8t2Y8PDlhxZwPAAsEXTWIGZY\r\nNyrFloJOk1VNUCGGN/luA/tQsPh+dpD3lW9f6G3G1VWMLGYcUWtF9TzZVG75\r\nzRpoPa/CbHBkFi9rlMI4/jE8URGq3qs7QrsvCM7AUBnRrqNzXm/g0LtN/La/\r\nOZA2231OF9vrEshB7KZ1c9Na1azKJfHN5wk=\r\n=SYbE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIArEufzhbX/Vl2pZ7q1FNTCPT+5r9kDNHl5eDvPPqGYTAiEAo2mdfRg9Gq+fl81yvGb5Z27LOl8f9JoRUqbIPYy2yXU="}],"size":3355,"noattachment":false,"key":"/@vespaiach/axios-fetch-adapter/-/@vespaiach/axios-fetch-adapter-0.2.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.2.0_1648148150101_0.0076756615888349256"},"_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":1648148150231,"_cnpm_publish_time":1648148150231,"dist-tags":{"latest":"0.3.1"}}