{"ast":null,"code":"import _regeneratorRuntime from \"@babel/runtime/regenerator\";\n// TODO: use this instead\n// https://github.com/zeit/swr/blob/master/examples/axios-typescript/libs/useRequest.ts\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nimport fetch from 'isomorphic-unfetch';\nexport var fetcher = function fetcher(url, options) {\n  var res, response;\n  return _regeneratorRuntime.async(function fetcher$(_context) {\n    while (1) {\n      switch (_context.prev = _context.next) {\n        case 0:\n          _context.next = 2;\n          return _regeneratorRuntime.awrap(fetch(process.env.API_URL + url, options));\n\n        case 2:\n          res = _context.sent;\n          _context.next = 5;\n          return _regeneratorRuntime.awrap(res.json());\n\n        case 5:\n          response = _context.sent;\n          return _context.abrupt(\"return\", response && 'data' in response ? response.data : response);\n\n        case 7:\n        case \"end\":\n          return _context.stop();\n      }\n    }\n  }, null, null, null, Promise);\n};\nexport var blobFetcher = function blobFetcher(url, options) {\n  var res;\n  return _regeneratorRuntime.async(function blobFetcher$(_context2) {\n    while (1) {\n      switch (_context2.prev = _context2.next) {\n        case 0:\n          _context2.next = 2;\n          return _regeneratorRuntime.awrap(fetch(process.env.API_URL + url, options));\n\n        case 2:\n          res = _context2.sent;\n          _context2.next = 5;\n          return _regeneratorRuntime.awrap(res.blob());\n\n        case 5:\n          return _context2.abrupt(\"return\", _context2.sent);\n\n        case 6:\n        case \"end\":\n          return _context2.stop();\n      }\n    }\n  }, null, null, null, Promise);\n};\nexport var cycleFetcher = function cycleFetcher(urls, options) {\n  return _regeneratorRuntime.async(function cycleFetcher$(_context3) {\n    while (1) {\n      switch (_context3.prev = _context3.next) {\n        case 0:\n          _context3.next = 2;\n          return _regeneratorRuntime.awrap(Promise.all(urls.map(function (url) {\n            return fetcher(url, options);\n          })));\n\n        case 2:\n          return _context3.abrupt(\"return\", _context3.sent);\n\n        case 3:\n        case \"end\":\n          return _context3.stop();\n      }\n    }\n  }, null, null, null, Promise);\n};","map":null,"metadata":{},"sourceType":"module"}