{"id":16349517,"url":"https://github.com/arojunior/handle-failed-requests-js","last_synced_at":"2025-03-21T00:30:35.428Z","repository":{"id":57260487,"uuid":"81116416","full_name":"arojunior/handle-failed-requests-js","owner":"arojunior","description":"Implementation of Offline-js with some improvements","archived":false,"fork":false,"pushed_at":"2019-10-26T02:34:46.000Z","size":101,"stargazers_count":29,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-09T09:03:17.635Z","etag":null,"topics":["axios","javascript","offline","offline-js"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arojunior.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-06T18:09:43.000Z","updated_at":"2024-06-25T03:07:59.000Z","dependencies_parsed_at":"2022-08-25T05:02:05.103Z","dependency_job_id":null,"html_url":"https://github.com/arojunior/handle-failed-requests-js","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arojunior%2Fhandle-failed-requests-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arojunior%2Fhandle-failed-requests-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arojunior%2Fhandle-failed-requests-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arojunior%2Fhandle-failed-requests-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arojunior","download_url":"https://codeload.github.com/arojunior/handle-failed-requests-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243851415,"owners_count":20358185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axios","javascript","offline","offline-js"],"created_at":"2024-10-11T01:00:07.921Z","updated_at":"2025-03-21T00:30:35.145Z","avatar_url":"https://github.com/arojunior.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# handle-failed-requests-js\n\n[![npm version](https://img.shields.io/npm/v/handle-failed-requests-js.svg)](https://www.npmjs.com/package/handle-failed-requests-js) [![npm downloads](https://img.shields.io/npm/dm/handle-failed-requests-js.svg)](https://www.npmjs.com/package/handle-failed-requests-js) [![Standard - JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n\nImplementation of [Offline-js](https://github.com/hubspot/offline) with some improvements\n\n# Why?\n\nBecause Offline-js has some bugs and inconsistencies\n\n# Features\n\n* Promises support (axios)\n* localStorage support\n* Save ALL the failed requests, not just the last one\n* Requests keep saved even if user try to refresh the page when offline\n* Send ALL failed requests when connection is up again\n* No need configuration\n\n![Alt text](https://user-images.githubusercontent.com/7604033/39336674-19212d44-498f-11e8-9239-5bdc0710be2f.gif 'Example')\n\n# How\n\n* Node / npm\n\n```shell\nnpm install --save handle-failed-requests-js\n```\n\n```javascript\nimport Request from 'handle-failed-requests-js';\n\nRequest.send({\n  method: 'put',\n  data: data,\n  url: '/'\n}).then(res =\u003e {\n  console.log(res);\n});\n```\n\n[example.html](https://github.com/arojunior/handle-failed-requests-js/blob/master/example.html)\n\n```html\n\u003cscript src=\"handle-requests.min.js\"\u003e\u003c/script\u003e\n```\n\n```javascript\nvar req = new Request();\n\n// default method is post\nreq.send('/', data).then(function(res) {\n  console.log(res);\n});\n\n// or\nreq\n  .send({\n    method: 'put',\n    data: data,\n    url: '/'\n  })\n  .then(function(res) {\n    console.log(res);\n  });\n```\n\nSee [Axios](https://github.com/mzabriskie/axios) documentation for requests options\n\n[Artigo em português](https://medium.com/@arojunior/enviando-requisi%C3%A7%C3%B5es-sem-se-preocupar-com-o-status-da-conex%C3%A3o-2c8aca05457)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farojunior%2Fhandle-failed-requests-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farojunior%2Fhandle-failed-requests-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farojunior%2Fhandle-failed-requests-js/lists"}