@@ -33850,43 +33850,39 @@ function useFetch(arg1, arg2) {
3385033850
3385133851 case 13:
3385233852 _data = _context.sent;
33853- _context.next = 27 ;
33853+ _context.next = 21 ;
3385433854 break;
3385533855
3385633856 case 16:
3385733857 _context.prev = 16;
3385833858 _context.t0 = _context["catch"](10);
33859- _context.prev = 18;
33860- _context.next = 21;
33859+ _context.next = 20;
3386133860 return response.text();
3386233861
33863- case 21 :
33862+ case 20 :
3386433863 _data = _context.sent;
33864+
33865+ case 21:
33866+ setData(_data);
3386533867 _context.next = 27;
3386633868 break;
3386733869
3386833870 case 24:
3386933871 _context.prev = 24;
33870- _context.t1 = _context["catch"](18 );
33871- setError("Currently only supports JSON and Text response types: ".concat( _context.t1) );
33872+ _context.t1 = _context["catch"](4 );
33873+ setError(_context.t1);
3387233874
3387333875 case 27:
33874- setData(_data) ;
33876+ _context.prev = 27 ;
3387533877 setLoading(false);
33876- _context.next = 34;
33877- break;
33878+ return _context.finish(27);
3387833879
33879- case 31:
33880- _context.prev = 31;
33881- _context.t2 = _context["catch"](4);
33882- setError(_context.t2);
33883-
33884- case 34:
33880+ case 30:
3388533881 case "end":
3388633882 return _context.stop();
3388733883 }
3388833884 }
33889- }, _callee, null, [[4, 31], [10, 16 ], [18, 24 ]]);
33885+ }, _callee, null, [[4, 24, 27, 30 ], [10, 16 ]]);
3389033886 }));
3389133887
3389233888 return function (_x, _x2) {
@@ -34213,22 +34209,11 @@ var App = function App() {
3421334209 data = _useFetch2[0],
3421434210 loading = _useFetch2[1],
3421534211 error = _useFetch2[2],
34216- refetch = _useFetch2[3]; // const handleClick = () => {
34217- // refetch()
34218- // }
34219- // const {data, loading, error, request} = useGet('https://api.etilbudsavis.dk/v2/dealerfront?country_id=DK')
34220- // const handleClick = () => {
34221- // Get()
34222- // }
34223- // console.log('DATA: ', data)
34224- // const [data, loading, error] = usePost('https://jsonplaceholder.typicode.com/posts', {
34225- // body: JSON.stringify({
34226- // title: 'foo',
34227- // body: 'bar',
34228- // userId: 1
34229- // })
34230- // })
34231- // WORKS 😍
34212+ get = _useFetch2[3].get;
34213+
34214+ var handleClick = function handleClick() {
34215+ return get();
34216+ }; // WORKS 😍
3423234217 // const [data, loading, error, request] = useFetch({
3423334218 // url: 'https://jsonplaceholder.typicode.com/posts/1',
3423434219 // // baseUrl: '', // then you can do: request.post({ url: '/posts', body: {} })
@@ -34252,83 +34237,83 @@ var App = function App() {
3425234237 // })
3425334238
3425434239
34255- var handleClick = function handleClick() {} // get('/1')
34256- // post('/', {
34257- // // params: '?no=way&something=true',
34258- // title: 'foo',
34259- // body: 'bar',
34260- // userId: 1
34261- // })
34262- // patch('/1', {
34263- // title: 'foo',
34264- // body: 'bar',
34265- // userId: 1
34266- // })
34267- // put('/1', {
34268- // title: 'foo',
34269- // body: 'bar',
34270- // userId: 1
34271- // })
34272- // del('/1')
34273- // request.get()
34274- // request.post({
34275- // // params: '?no=way&something=true',
34276- // title: 'foo',
34277- // body: 'bar',
34278- // userId: 1
34279- // })
34280- // request.patch({
34281- // title: 'foo',
34282- // body: 'bar',
34283- // userId: 1
34284- // })
34285- // request.put({
34286- // title: 'foo',
34287- // body: 'bar',
34288- // userId: 1
34289- // })
34290- // request.delete({
34291- // title: 'foo',
34292- // body: 'bar',
34293- // userId: 1
34294- // })
34295- // get()
34296- // post({
34297- // // params: '?no=way&something=true',
34298- // title: 'foo',
34299- // body: 'bar',
34300- // userId: 1
34301- // })
34302- // patch({
34303- // title: 'foo',
34304- // body: 'bar',
34305- // userId: 1
34306- // })
34307- // put({
34308- // title: 'foo',
34309- // body: 'bar',
34310- // userId: 1
34311- // })
34312- // del({
34313- // title: 'foo',
34314- // body: 'bar',
34315- // userId: 1
34316- // })
34317- // if (error) return 'Error...'
34318- // if (loading) return 'Loading...'
34319- ;
34240+ var handleClick2 = function handleClick2() {// get('/1')
34241+ // post('/', {
34242+ // // params: '?no=way&something=true',
34243+ // title: 'foo',
34244+ // body: 'bar',
34245+ // userId: 1
34246+ // })
34247+ // patch('/1', {
34248+ // title: 'foo',
34249+ // body: 'bar',
34250+ // userId: 1
34251+ // })
34252+ // put('/1', {
34253+ // title: 'foo',
34254+ // body: 'bar',
34255+ // userId: 1
34256+ // })
34257+ // del('/1')
34258+ // request.get()
34259+ // request.post({
34260+ // // params: '?no=way&something=true',
34261+ // title: 'foo',
34262+ // body: 'bar',
34263+ // userId: 1
34264+ // })
34265+ // request.patch({
34266+ // title: 'foo',
34267+ // body: 'bar',
34268+ // userId: 1
34269+ // })
34270+ // request.put({
34271+ // title: 'foo',
34272+ // body: 'bar',
34273+ // userId: 1
34274+ // })
34275+ // request.delete({
34276+ // title: 'foo',
34277+ // body: 'bar',
34278+ // userId: 1
34279+ // })
34280+ // get()
34281+ // post({
34282+ // // params: '?no=way&something=true',
34283+ // title: 'foo',
34284+ // body: 'bar',
34285+ // userId: 1
34286+ // })
34287+ // patch({
34288+ // title: 'foo',
34289+ // body: 'bar',
34290+ // userId: 1
34291+ // })
34292+ // put({
34293+ // title: 'foo',
34294+ // body: 'bar',
34295+ // userId: 1
34296+ // })
34297+ // del({
34298+ // title: 'foo',
34299+ // body: 'bar',
34300+ // userId: 1
34301+ // })
34302+ };
3432034303
34304+ if (error) return 'Error...';
34305+ if (loading) return 'Loading...';
3432134306 return _react.default.createElement("div", {
3432234307 className: "App"
34323- }, "HELLO WORL", _react.default.createElement("header", {
34308+ }, _react.default.createElement("header", {
3432434309 className: "App-header"
3432534310 }, _react.default.createElement("button", {
3432634311 onClick: handleClick
3432734312 }, "CLICK"), _react.default.createElement("code", {
3432834313 style: {
3432934314 display: 'block'
3433034315 }
34331- })));
34316+ }, _react.default.createElement("pre", null, JSON.stringify(data, null, 2)) )));
3433234317};
3433334318
3433434319(0, _reactDom.render)(_react.default.createElement(App, null), document.getElementById('root')); // If you want your app to work offline and load faster, you can change
@@ -34364,7 +34349,7 @@ var parent = module.bundle.parent;
3436434349if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
3436534350 var hostname = "" || location.hostname;
3436634351 var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
34367- var ws = new WebSocket(protocol + '://' + hostname + ':' + "56755 " + '/');
34352+ var ws = new WebSocket(protocol + '://' + hostname + ':' + "63592 " + '/');
3436834353
3436934354 ws.onmessage = function (event) {
3437034355 checkedAssets = {};
0 commit comments