turbo-web 4.2.8 → 4.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/turbo.js +21 -1
- package/package.json +1 -1
package/dist/turbo.js
CHANGED
|
@@ -1252,4 +1252,24 @@ class Store {
|
|
|
1252
1252
|
}
|
|
1253
1253
|
}
|
|
1254
1254
|
|
|
1255
|
-
|
|
1255
|
+
class TurboHTTP {
|
|
1256
|
+
constructor(baseURL = '') {
|
|
1257
|
+
this.baseURL = baseURL;
|
|
1258
|
+
}
|
|
1259
|
+
async get(endpoint) {
|
|
1260
|
+
const response = await fetch(`${this.baseURL}${endpoint}`);
|
|
1261
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
1262
|
+
return response.json();
|
|
1263
|
+
}
|
|
1264
|
+
async post(endpoint, payload) {
|
|
1265
|
+
const response = await fetch(`${this.baseURL}${endpoint}`, {
|
|
1266
|
+
method: 'POST',
|
|
1267
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1268
|
+
body: JSON.stringify(payload)
|
|
1269
|
+
});
|
|
1270
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
1271
|
+
return response.json();
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
export { DOM_TYPES, HashRouter, RouterLink, RouterOutlet, Store, TurboHTTP, createApp, defineComponent, h, hFragment, hSlot, hString, nextTick };
|