@@ -33850,43 +33850,39 @@ function useFetch(arg1, arg2) {
33850
33850
33851
33851
case 13:
33852
33852
_data = _context.sent;
33853
- _context.next = 27 ;
33853
+ _context.next = 21 ;
33854
33854
break;
33855
33855
33856
33856
case 16:
33857
33857
_context.prev = 16;
33858
33858
_context.t0 = _context["catch"](10);
33859
- _context.prev = 18;
33860
- _context.next = 21;
33859
+ _context.next = 20;
33861
33860
return response.text();
33862
33861
33863
- case 21 :
33862
+ case 20 :
33864
33863
_data = _context.sent;
33864
+
33865
+ case 21:
33866
+ setData(_data);
33865
33867
_context.next = 27;
33866
33868
break;
33867
33869
33868
33870
case 24:
33869
33871
_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);
33872
33874
33873
33875
case 27:
33874
- setData(_data) ;
33876
+ _context.prev = 27 ;
33875
33877
setLoading(false);
33876
- _context.next = 34;
33877
- break;
33878
+ return _context.finish(27);
33878
33879
33879
- case 31:
33880
- _context.prev = 31;
33881
- _context.t2 = _context["catch"](4);
33882
- setError(_context.t2);
33883
-
33884
- case 34:
33880
+ case 30:
33885
33881
case "end":
33886
33882
return _context.stop();
33887
33883
}
33888
33884
}
33889
- }, _callee, null, [[4, 31], [10, 16 ], [18, 24 ]]);
33885
+ }, _callee, null, [[4, 24, 27, 30 ], [10, 16 ]]);
33890
33886
}));
33891
33887
33892
33888
return function (_x, _x2) {
@@ -34213,22 +34209,11 @@ var App = function App() {
34213
34209
data = _useFetch2[0],
34214
34210
loading = _useFetch2[1],
34215
34211
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 😍
34232
34217
// const [data, loading, error, request] = useFetch({
34233
34218
// url: 'https://jsonplaceholder.typicode.com/posts/1',
34234
34219
// // baseUrl: '', // then you can do: request.post({ url: '/posts', body: {} })
@@ -34252,83 +34237,83 @@ var App = function App() {
34252
34237
// })
34253
34238
34254
34239
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
+ };
34320
34303
34304
+ if (error) return 'Error...';
34305
+ if (loading) return 'Loading...';
34321
34306
return _react.default.createElement("div", {
34322
34307
className: "App"
34323
- }, "HELLO WORL", _react.default.createElement("header", {
34308
+ }, _react.default.createElement("header", {
34324
34309
className: "App-header"
34325
34310
}, _react.default.createElement("button", {
34326
34311
onClick: handleClick
34327
34312
}, "CLICK"), _react.default.createElement("code", {
34328
34313
style: {
34329
34314
display: 'block'
34330
34315
}
34331
- })));
34316
+ }, _react.default.createElement("pre", null, JSON.stringify(data, null, 2)) )));
34332
34317
};
34333
34318
34334
34319
(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;
34364
34349
if ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {
34365
34350
var hostname = "" || location.hostname;
34366
34351
var protocol = location.protocol === 'https:' ? 'wss' : 'ws';
34367
- var ws = new WebSocket(protocol + '://' + hostname + ':' + "56755 " + '/');
34352
+ var ws = new WebSocket(protocol + '://' + hostname + ':' + "63592 " + '/');
34368
34353
34369
34354
ws.onmessage = function (event) {
34370
34355
checkedAssets = {};
0 commit comments