{"id":18273551,"url":"https://github.com/rus-sharafiev/fetch-api","last_synced_at":"2026-01-26T02:32:33.756Z","repository":{"id":169542240,"uuid":"645522133","full_name":"rus-sharafiev/fetch-api","owner":"rus-sharafiev","description":"A simple wrapper around the Fetch API","archived":false,"fork":false,"pushed_at":"2024-10-27T18:36:35.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-19T16:18:03.080Z","etag":null,"topics":["fetch-api","token-refresh"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/rus-sharafiev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-25T21:06:20.000Z","updated_at":"2024-10-27T18:36:38.000Z","dependencies_parsed_at":"2024-10-27T20:03:45.370Z","dependency_job_id":"63eff2b4-524d-4385-98b9-127b34c39862","html_url":"https://github.com/rus-sharafiev/fetch-api","commit_stats":null,"previous_names":["rus-sharafiev/fwr"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/rus-sharafiev/fetch-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rus-sharafiev%2Ffetch-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rus-sharafiev%2Ffetch-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rus-sharafiev%2Ffetch-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rus-sharafiev%2Ffetch-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rus-sharafiev","download_url":"https://codeload.github.com/rus-sharafiev/fetch-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rus-sharafiev%2Ffetch-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28765057,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T02:25:41.078Z","status":"ssl_error","status_checked_at":"2026-01-26T02:24:28.809Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["fetch-api","token-refresh"],"created_at":"2024-11-05T12:06:52.997Z","updated_at":"2026-01-26T02:32:33.740Z","avatar_url":"https://github.com/rus-sharafiev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fetch with access token refresh\n\n[![npm](https://img.shields.io/npm/v/%40russh%2Ffetch-api)](https://npm.im/@russh/fetch-api)\n\nA simple wrapper around the Fetch API with \n- Access token refresh on 401 response status\n- Shorthands\n- RTK baseQuery\n- JSON to FormData converter (requires custom middleware on backend)\n\n## Install\n\n```\nnpm i @russh/fetch-api\n```\n\n## Usage\n\nFirst create an instance of the FetchApi class with a base URL and optionally a path name to refresh the access token.\n```ts\nconst api = new FetchApi('https://example.com', '/refresh-token')\n```\nThen use full declaration...\n```ts\nconst result = await api.fetch({ url: '/path', method: 'POST', body: { foo: 'bar' } })\n```\n...or shorthand to get fetch data\n\n```ts\nawait api.get('/path')\nawait api.post('/path', { foo: 'bar' })\nawait api.patch('/path/id', { foo: 'bar' })\nawait api.delete('/path/id')\n```\nThe instance also contains fetch-api based RTK baseQuery\n\n```ts\nexport const apiName = createApi({\n    reducerPath: 'apiName',\n    baseQuery: api.baseQuery,\n    endpoints: (builder) =\u003e ({\n    ...\n    })\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frus-sharafiev%2Ffetch-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frus-sharafiev%2Ffetch-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frus-sharafiev%2Ffetch-api/lists"}