@datagouv/components-next 1.0.2-dev.123 → 1.0.2-dev.124
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/{Datafair.client-DMmJ6GZp.js → Datafair.client-CjpYc4I-.js} +1 -1
- package/dist/{JsonPreview.client-BJl0ckqf.js → JsonPreview.client-CtIV5Hye.js} +2 -2
- package/dist/{MapContainer.client-BOILtnvJ.js → MapContainer.client-zZBtNnFc.js} +2 -2
- package/dist/{PdfPreview.client-D7YzJBjf.js → PdfPreview.client-CXdg6Yhu.js} +2 -2
- package/dist/{Pmtiles.client-DYui1P0X.js → Pmtiles.client-CPTbviF2.js} +1 -1
- package/dist/{PreviewWrapper.vue_vue_type_script_setup_true_lang-B1hQo45t.js → PreviewWrapper.vue_vue_type_script_setup_true_lang-DbM6EH52.js} +1 -1
- package/dist/{XmlPreview.client-CNBElgL_.js → XmlPreview.client-Ct3QWNLh.js} +3 -3
- package/dist/components-next.js +1 -1
- package/dist/{index-O6jmaKXj.js → index-BYX8slnw.js} +1 -1
- package/dist/{leaflet-src-KM7yab2d.js → leaflet-src-DsG-COYE.js} +1 -1
- package/dist/{main-B40Z2ZUX.js → main-B_qMC--3.js} +22 -19
- package/dist/{vue3-xml-viewer.common-DPhRUkLi.js → vue3-xml-viewer.common-BM77n2ky.js} +1 -1
- package/package.json +1 -1
- package/src/functions/api.ts +13 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as l, computed as a, openBlock as t, createElementBlock as o, createElementVNode as u, createBlock as f, withCtx as p, createTextVNode as m, toDisplayString as _, unref as h } from "vue";
|
|
2
|
-
import { c2 as x, _ as g } from "./main-
|
|
2
|
+
import { c2 as x, _ as g } from "./main-B_qMC--3.js";
|
|
3
3
|
const v = { class: "fr-text--xs" }, b = { key: 0 }, k = ["src"], $ = /* @__PURE__ */ l({
|
|
4
4
|
__name: "Datafair.client",
|
|
5
5
|
props: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as c, defineAsyncComponent as u, openBlock as m, createBlock as p, unref as r, withCtx as f, createVNode as l } from "vue";
|
|
2
|
-
import { bP as d } from "./main-
|
|
3
|
-
import { _ as h } from "./PreviewWrapper.vue_vue_type_script_setup_true_lang-
|
|
2
|
+
import { bP as d } from "./main-B_qMC--3.js";
|
|
3
|
+
import { _ as h } from "./PreviewWrapper.vue_vue_type_script_setup_true_lang-DbM6EH52.js";
|
|
4
4
|
const J = /* @__PURE__ */ c({
|
|
5
5
|
__name: "JsonPreview.client",
|
|
6
6
|
props: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as E, useTemplateRef as G, ref as W, onMounted as B, openBlock as u, createBlock as z, withCtx as N, createTextVNode as V, toDisplayString as q, unref as A, createElementBlock as D } from "vue";
|
|
2
|
-
import { c2 as F, _ as O } from "./main-
|
|
2
|
+
import { c2 as F, _ as O } from "./main-B_qMC--3.js";
|
|
3
3
|
const Z = /* @__PURE__ */ E({
|
|
4
4
|
__name: "MapContainer.client",
|
|
5
5
|
props: {
|
|
@@ -24,7 +24,7 @@ const Z = /* @__PURE__ */ E({
|
|
|
24
24
|
import("./Tile-D6rFonpT.js").then((t) => t.T),
|
|
25
25
|
import("./OSM-gdDSIsDA.js"),
|
|
26
26
|
// @ts-expect-error no types provided
|
|
27
|
-
import("./index-
|
|
27
|
+
import("./index-BYX8slnw.js")
|
|
28
28
|
]), { CRS: _, GeoportalAttribution: S, GeoportalFullScreen: b, GeoportalZoom: g, LayerImport: v, LayerSwitcher: L } = C;
|
|
29
29
|
await Promise.resolve({ }), await Promise.resolve({ }), await Promise.resolve({ }), await Promise.resolve({ }), _.load(), e = new s({
|
|
30
30
|
target: a.value,
|
|
@@ -12,8 +12,8 @@ var sZ = (R, l, U, Z) => ({
|
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
import { defineComponent as cd, ref as td, onBeforeUnmount as Rd, openBlock as LU, createBlock as Nd, unref as sd, withCtx as bd, createElementVNode as nd, createElementBlock as bZ, Fragment as ad, renderList as hd } from "vue";
|
|
15
|
-
import { _ as md } from "./PreviewWrapper.vue_vue_type_script_setup_true_lang-
|
|
16
|
-
import { bP as id } from "./main-
|
|
15
|
+
import { _ as md } from "./PreviewWrapper.vue_vue_type_script_setup_true_lang-DbM6EH52.js";
|
|
16
|
+
import { bP as id } from "./main-B_qMC--3.js";
|
|
17
17
|
var ZU = {};
|
|
18
18
|
ZU.d = (R, l) => {
|
|
19
19
|
for (var U in l)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as b0, ref as w0, computed as Oc, useTemplateRef as T0, onMounted as S0, openBlock as gh, createElementBlock as tp, createBlock as P0, withCtx as Um, createTextVNode as Gm, toDisplayString as Bc, unref as ts, createElementVNode as ho, createVNode as I0, createCommentVNode as E0 } from "vue";
|
|
2
|
-
import { b4 as M0, c2 as A0, bS as C0, bP as D0, bg as z0, bf as R0, _ as k0, aY as L0, l as F0, Q as O0, bJ as B0 } from "./main-
|
|
2
|
+
import { b4 as M0, c2 as A0, bS as C0, bP as D0, bg as z0, bf as R0, _ as k0, aY as L0, l as F0, Q as O0, bJ as B0 } from "./main-B_qMC--3.js";
|
|
3
3
|
var nn = Uint8Array, xl = Uint16Array, N0 = Int32Array, ag = new nn([
|
|
4
4
|
0,
|
|
5
5
|
0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent as _, ref as g, computed as h, onMounted as S, nextTick as w, openBlock as l, createElementBlock as k, renderSlot as C, toDisplayString as r, unref as a, createBlock as n, withCtx as o, createTextVNode as u, createCommentVNode as b } from "vue";
|
|
2
|
-
import { c2 as B, bj as E, bh as L, _ as c } from "./main-
|
|
2
|
+
import { c2 as B, bj as E, bh as L, _ as c } from "./main-B_qMC--3.js";
|
|
3
3
|
const R = { class: "text-xs" }, q = {
|
|
4
4
|
key: 1,
|
|
5
5
|
class: "text-gray-medium"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineComponent as i, defineAsyncComponent as m, openBlock as u, createBlock as f, unref as t, withCtx as l, createVNode as p } from "vue";
|
|
2
|
-
import { bP as x } from "./main-
|
|
3
|
-
import { _ as w } from "./PreviewWrapper.vue_vue_type_script_setup_true_lang-
|
|
2
|
+
import { bP as x } from "./main-B_qMC--3.js";
|
|
3
|
+
import { _ as w } from "./PreviewWrapper.vue_vue_type_script_setup_true_lang-DbM6EH52.js";
|
|
4
4
|
const X = /* @__PURE__ */ i({
|
|
5
5
|
__name: "XmlPreview.client",
|
|
6
6
|
props: {
|
|
@@ -8,7 +8,7 @@ const X = /* @__PURE__ */ i({
|
|
|
8
8
|
},
|
|
9
9
|
setup(r) {
|
|
10
10
|
const o = m(
|
|
11
|
-
() => import("./vue3-xml-viewer.common-
|
|
11
|
+
() => import("./vue3-xml-viewer.common-BM77n2ky.js").then((e) => e.v).then((e) => e.default || e.XmlViewer)
|
|
12
12
|
), n = r, s = x(), c = async () => {
|
|
13
13
|
const e = await fetch(n.resource.url);
|
|
14
14
|
if (!e.ok) throw new Error(`HTTP error! status: ${e.status}`);
|
package/dist/components-next.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as e, a as t, m as r, n as o, o as i, p as n, q as c, r as l, l as b, C as u, b as g, c as d, D as T, d as p, s as C, e as S, t as D, u as m, v as O, w as R, x as f, y as E, z as I, B as y, E as h, F as A, G as M, H as L, f as v, g as z, I as P, J as w, K as F, M as G, N, L as _, S as k, V as x, W as B, X as U, Y as H, Z as V, $ as Q, O as W, h as j, a0 as Y, a1 as X, a2 as q, a3 as J, a4 as K, a5 as Z, a6 as $, a7 as aa, P as sa, a8 as ea, a9 as ta, aa as ra, ab as oa, ac as ia, R as na, ad as ca, ae as la, af as ba, i as ua, ag as ga, ah as da, ai as Ta, aj as pa, ak as Ca, al as Sa, am as Da, an as ma, ao as Oa, ap as Ra, aq as fa, ar as Ea, as as Ia, at as ya, T as ha, au as Aa, j as Ma, av as La, aw as va, ax as za, ay as Pa, k as wa, az as Fa, aA as Ga, aB as Na, aC as _a, U as ka, aD as xa, aE as Ba, aF as Ua, aG as Ha, aI as Va, aJ as Qa, aK as Wa, aL as ja, aM as Ya, aN as Xa, aO as qa, aP as Ja, aQ as Ka, aR as Za, aS as $a, aT as as, aU as ss, aV as es, aW as ts, aX as rs, aZ as os, a_ as is, a$ as ns, b0 as cs, b1 as ls, b2 as bs, b3 as us, b5 as gs, b6 as ds, b7 as Ts, b8 as ps, b9 as Cs, ba as Ss, bb as Ds, bc as ms, bd as Os, be as Rs, bf as fs, bg as Es, bh as Is, bi as ys, bj as hs, bk as As, bl as Ms, bm as Ls, bn as vs, bo as zs, bp as Ps, bq as ws, br as Fs, bs as Gs, bt as Ns, bu as _s, bv as ks, bw as xs, bx as Bs, by as Us, bz as Hs, bA as Vs, bB as Qs, bC as Ws, bD as js, bE as Ys, bF as Xs, bF as qs, bG as Js, bH as Ks, bI as Zs, bJ as $s, bK as ae, bL as se, bM as ee, bN as te, bO as re, bP as oe, bQ as ie, bR as ne, bS as ce, bT as le, bU as be, bV as ue, bW as ge, bX as de, bY as Te, bZ as pe, b_ as Ce, b$ as Se, c0 as De, c1 as me, c2 as Oe } from "./main-
|
|
1
|
+
import { A as e, a as t, m as r, n as o, o as i, p as n, q as c, r as l, l as b, C as u, b as g, c as d, D as T, d as p, s as C, e as S, t as D, u as m, v as O, w as R, x as f, y as E, z as I, B as y, E as h, F as A, G as M, H as L, f as v, g as z, I as P, J as w, K as F, M as G, N, L as _, S as k, V as x, W as B, X as U, Y as H, Z as V, $ as Q, O as W, h as j, a0 as Y, a1 as X, a2 as q, a3 as J, a4 as K, a5 as Z, a6 as $, a7 as aa, P as sa, a8 as ea, a9 as ta, aa as ra, ab as oa, ac as ia, R as na, ad as ca, ae as la, af as ba, i as ua, ag as ga, ah as da, ai as Ta, aj as pa, ak as Ca, al as Sa, am as Da, an as ma, ao as Oa, ap as Ra, aq as fa, ar as Ea, as as Ia, at as ya, T as ha, au as Aa, j as Ma, av as La, aw as va, ax as za, ay as Pa, k as wa, az as Fa, aA as Ga, aB as Na, aC as _a, U as ka, aD as xa, aE as Ba, aF as Ua, aG as Ha, aI as Va, aJ as Qa, aK as Wa, aL as ja, aM as Ya, aN as Xa, aO as qa, aP as Ja, aQ as Ka, aR as Za, aS as $a, aT as as, aU as ss, aV as es, aW as ts, aX as rs, aZ as os, a_ as is, a$ as ns, b0 as cs, b1 as ls, b2 as bs, b3 as us, b5 as gs, b6 as ds, b7 as Ts, b8 as ps, b9 as Cs, ba as Ss, bb as Ds, bc as ms, bd as Os, be as Rs, bf as fs, bg as Es, bh as Is, bi as ys, bj as hs, bk as As, bl as Ms, bm as Ls, bn as vs, bo as zs, bp as Ps, bq as ws, br as Fs, bs as Gs, bt as Ns, bu as _s, bv as ks, bw as xs, bx as Bs, by as Us, bz as Hs, bA as Vs, bB as Qs, bC as Ws, bD as js, bE as Ys, bF as Xs, bF as qs, bG as Js, bH as Ks, bI as Zs, bJ as $s, bK as ae, bL as se, bM as ee, bN as te, bO as re, bP as oe, bQ as ie, bR as ne, bS as ce, bT as le, bU as be, bV as ue, bW as ge, bX as de, bY as Te, bZ as pe, b_ as Ce, b$ as Se, c0 as De, c1 as me, c2 as Oe } from "./main-B_qMC--3.js";
|
|
2
2
|
export {
|
|
3
3
|
e as AI_SUGGESTION_MIN_DESCRIPTION_LENGTH,
|
|
4
4
|
t as ASSOCIATION,
|
|
@@ -6,7 +6,7 @@ import { T as TileGrid, U as UrlTile, g as extentFromProjection, e as createXYZ,
|
|
|
6
6
|
import { D as DEFAULT_MAX_ZOOM, c as assert, i as forEach, l as intersectsLineString, m as intersectsLineStringArray, s as linearRingssContainsXY, p as intersectsLinearRingMultiArray, d as compose, e as create, b as apply, x as setFromArray, u as multiply, w as scale, v as reset, z as translate } from "./common-C8efyyuc.js";
|
|
7
7
|
import { R as RBush$1, a as Collection, b as CollectionEventType, m as asColorLike, p as defaultFillStyle, z as defaultStrokeStyle, r as defaultLineCap, s as defaultLineDash, t as defaultLineDashOffset, u as defaultLineJoin, v as defaultLineWidth, w as defaultMiterLimit, y as defaultStrokeOffset, x as defaultPadding, E as defaultTextBaseline, D as defaultTextAlign, q as defaultFont, Q as registerFont, H as getTextDimensions, G as drawImageOrLabel, J as measureAndCacheTextWidth, I as Icon, B as BaseVectorLayer, P as PointerInteraction, L as noModifierKeys, l as always, U as shiftKeyOnly, e as InteractionProperty, h as MapBrowserEventType, g as MapBrowserEvent, K as never, o as createEditingStyle, O as primaryAction, k as altKeyOnly, V as singleClick, d as Interaction, F as Fill, S as Stroke, T as Text, j as Style$1, C as CircleStyle, n as checkedFonts, M as Map$1, N as pointerMove, c as ImageStyle, A as Attribution, Z as Zoom, i as MapProperty } from "./Map-CtP7leHl.js";
|
|
8
8
|
import { S as SimpleGeometry, C as maxSquaredDelta, h as assignClosestPoint, v as inflateCoordinates, o as douglasPeucker, k as deflateCoordinates, e as arrayMaxSquaredDelta, f as assignClosestArrayPoint, w as inflateCoordinatesArray, p as douglasPeuckerArray, l as deflateCoordinatesArray, P as Point$1, D as multiArrayMaxSquaredDelta, g as assignClosestMultiArrayPoint, A as linearRingss$1, F as orientLinearRingsArray, y as inflateMultiCoordinatesArray, s as getInteriorPointsOfMultiArray, B as linearRingssAreOriented, I as quantizeMultiArray, a as Polygon, m as deflateMultiCoordinatesArray, r as getInteriorPointOfArray, x as inflateEnds, M as transform2D, H as quantizeArray, j as deflateCoordinate, J as rotate, K as snap, N as transformGeom2D, c as ViewHint, G as Geometry, u as getStrideForLayout, z as linearRingsAreOriented, E as orientLinearRings, t as getLayoutForStride, i as circular, L as LinearRing, V as View, d as ViewProperty, q as fromExtent } from "./View-vp7vDb9q.js";
|
|
9
|
-
import { aH as commonjsGlobal, b4 as getDefaultExportFromCjs$1 } from "./main-
|
|
9
|
+
import { aH as commonjsGlobal, b4 as getDefaultExportFromCjs$1 } from "./main-B_qMC--3.js";
|
|
10
10
|
import { a as RenderEventType, b as asArray, B as BaseLayer } from "./Event-py_AAwJY.js";
|
|
11
11
|
import { Z as ZIndexContext, C as CanvasLayerRenderer, d as canvasPool$1, b as TileLayer, a as CanvasTileLayerRenderer, c as TileProperty } from "./Tile-D6rFonpT.js";
|
|
12
12
|
function padNumber(i, e, t) {
|
|
@@ -875,23 +875,26 @@ async function Ve(e, t) {
|
|
|
875
875
|
const i = b2();
|
|
876
876
|
if (i.customUseFetch)
|
|
877
877
|
return await i.customUseFetch(e, t);
|
|
878
|
-
const r = t?.raw, n = X(null), l = X(null), a = X("idle"), c = async () => {
|
|
879
|
-
const
|
|
880
|
-
if (!
|
|
881
|
-
const
|
|
878
|
+
const r = t?.raw, n = X(null), l = X(null), a = X("idle"), c = async (u) => {
|
|
879
|
+
const h = Y1(e);
|
|
880
|
+
if (!h) return;
|
|
881
|
+
const d = so(t?.params), p = so(t?.query);
|
|
882
882
|
a.value = "pending";
|
|
883
883
|
try {
|
|
884
|
-
n.value = r ? await kt(
|
|
885
|
-
} catch (
|
|
886
|
-
|
|
884
|
+
n.value = r ? await kt(h, { params: d ?? p, signal: u }) : await i.$fetch(h, { baseURL: i.apiBase, params: d ?? p, signal: u }), a.value = "success";
|
|
885
|
+
} catch (C) {
|
|
886
|
+
if (u?.aborted) return;
|
|
887
|
+
l.value = C, a.value = "error";
|
|
887
888
|
}
|
|
888
889
|
};
|
|
889
890
|
return t?.server === !1 ? i2(() => {
|
|
890
|
-
p2(
|
|
891
|
-
|
|
891
|
+
p2((u) => {
|
|
892
|
+
const h = new AbortController();
|
|
893
|
+
u(() => h.abort()), c(h.signal);
|
|
892
894
|
});
|
|
893
|
-
}) : p2(
|
|
894
|
-
|
|
895
|
+
}) : p2((u) => {
|
|
896
|
+
const h = new AbortController();
|
|
897
|
+
u(() => h.abort()), c(h.signal);
|
|
895
898
|
}), {
|
|
896
899
|
data: n,
|
|
897
900
|
refresh: () => c(),
|
|
@@ -50877,7 +50880,7 @@ const IP = { class: "space-y-1 py-6" }, PP = { class: "flex items-center space-x
|
|
|
50877
50880
|
const t = e, i = X(null);
|
|
50878
50881
|
return i2(async () => {
|
|
50879
50882
|
await Promise.resolve({ });
|
|
50880
|
-
const r = await import("./leaflet-src-
|
|
50883
|
+
const r = await import("./leaflet-src-DsG-COYE.js").then((a) => a.l);
|
|
50881
50884
|
if (!i.value) return;
|
|
50882
50885
|
const n = r.map(i.value);
|
|
50883
50886
|
r.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
|
@@ -58261,7 +58264,7 @@ const fG = {
|
|
|
58261
58264
|
canEdit: { type: Boolean, default: !1 }
|
|
58262
58265
|
},
|
|
58263
58266
|
setup(e) {
|
|
58264
|
-
const t = ["url", "doi", "www:link", " www:link-1.0-http--link", "www:link-1.0-http--partners", "www:link-1.0-http--related", "www:link-1.0-http--samples"], i = e, r = b2(), n = Et(() => import("./MapContainer.client-
|
|
58267
|
+
const t = ["url", "doi", "www:link", " www:link-1.0-http--link", "www:link-1.0-http--partners", "www:link-1.0-http--related", "www:link-1.0-http--samples"], i = e, r = b2(), n = Et(() => import("./MapContainer.client-zZBtNnFc.js")), l = Et(() => import("./Pmtiles.client-CPTbviF2.js")), a = Et(() => import("./JsonPreview.client-CtIV5Hye.js")), c = Et(() => import("./PdfPreview.client-CXdg6Yhu.js")), u = Et(() => import("./XmlPreview.client-Ct3QWNLh.js")), h = Et(() => import("./Datafair.client-CjpYc4I-.js")), { t: d } = z1(), { formatRelativeIfRecentDate: p } = ut(), C = bf(), g = A(() => {
|
|
58265
58268
|
const d1 = i.resource.format?.toLowerCase();
|
|
58266
58269
|
return d1 === "json" || d1 === "pdf" || d1 === "xml";
|
|
58267
58270
|
}), m = A(() => C(i.resource)), f = A(() => i.resource.extras["analysis:parsing:pmtiles_url"] || i.resource.format === "pmtiles"), x = A(() => E9(i.dataset.organization) && i.resource.extras.datafairEmbed), y = A(() => E9(i.dataset.organization) && i.resource.extras.apidocUrl), v = A(() => Al(i.resource.format) ? i.resource.format : d("Fichier")), V = A(() => Mf(i.resource)), N = A(() => V.value === "wms"), z = X(i.expandedOnMount), M = () => {
|
|
@@ -60087,17 +60090,17 @@ const $K = /* @__PURE__ */ o({
|
|
|
60087
60090
|
async setup(e, { emit: t }) {
|
|
60088
60091
|
let i, r;
|
|
60089
60092
|
const n = Et(
|
|
60090
|
-
() => import("./JsonPreview.client-
|
|
60093
|
+
() => import("./JsonPreview.client-CtIV5Hye.js")
|
|
60091
60094
|
), l = Et(
|
|
60092
|
-
() => import("./PdfPreview.client-
|
|
60095
|
+
() => import("./PdfPreview.client-CXdg6Yhu.js")
|
|
60093
60096
|
), a = Et(
|
|
60094
|
-
() => import("./XmlPreview.client-
|
|
60097
|
+
() => import("./XmlPreview.client-Ct3QWNLh.js")
|
|
60095
60098
|
), c = Et(
|
|
60096
|
-
() => import("./Datafair.client-
|
|
60099
|
+
() => import("./Datafair.client-CjpYc4I-.js")
|
|
60097
60100
|
), u = Et(
|
|
60098
|
-
() => import("./MapContainer.client-
|
|
60101
|
+
() => import("./MapContainer.client-zZBtNnFc.js")
|
|
60099
60102
|
), h = Et(
|
|
60100
|
-
() => import("./Pmtiles.client-
|
|
60103
|
+
() => import("./Pmtiles.client-CPTbviF2.js")
|
|
60101
60104
|
), d = e, p = t, { t: C } = z1(), g = b2(), { formatRelativeIfRecentDate: m } = ut(), {
|
|
60102
60105
|
hasTabularData: f,
|
|
60103
60106
|
hasPmtiles: x,
|
package/package.json
CHANGED
package/src/functions/api.ts
CHANGED
|
@@ -26,7 +26,7 @@ export async function useFetch<DataT, ErrorT = never>(
|
|
|
26
26
|
const error: Ref<ErrorT | null> = ref(null)
|
|
27
27
|
const status = ref<AsyncDataRequestStatus>('idle')
|
|
28
28
|
|
|
29
|
-
const execute = async () => {
|
|
29
|
+
const execute = async (signal?: AbortSignal) => {
|
|
30
30
|
const urlValue = toValue(url)
|
|
31
31
|
if (!urlValue) return
|
|
32
32
|
const params = deepToValue(options?.params)
|
|
@@ -36,13 +36,15 @@ export async function useFetch<DataT, ErrorT = never>(
|
|
|
36
36
|
data.value = isRaw
|
|
37
37
|
// Raw targets another data.gouv service (the Tabular API in TabularExplorer) via its own
|
|
38
38
|
// absolute URL, so it must stay bare ofetch: no datagouv apiBase, no datagouv auth attached.
|
|
39
|
-
? await ofetch<DataT | null>(urlValue, { params: params ?? query })
|
|
39
|
+
? await ofetch<DataT | null>(urlValue, { params: params ?? query, signal })
|
|
40
40
|
// The configured `$fetch` carries baseURL + auth + headers (see the `datagouv` plugin install
|
|
41
41
|
// for the default one). We only forward the URL and params here.
|
|
42
|
-
: await config.$fetch<DataT | null>(urlValue, { baseURL: config.apiBase, params: params ?? query })
|
|
42
|
+
: await config.$fetch<DataT | null>(urlValue, { baseURL: config.apiBase, params: params ?? query, signal })
|
|
43
43
|
status.value = 'success'
|
|
44
44
|
}
|
|
45
45
|
catch (e) {
|
|
46
|
+
// Ignore aborted requests — they're superseded by a newer call, not a real error.
|
|
47
|
+
if (signal?.aborted) return
|
|
46
48
|
error.value = e as ErrorT
|
|
47
49
|
status.value = 'error'
|
|
48
50
|
}
|
|
@@ -51,14 +53,18 @@ export async function useFetch<DataT, ErrorT = never>(
|
|
|
51
53
|
// When server is false, only start watching after mount (client-side only)
|
|
52
54
|
if (options?.server === false) {
|
|
53
55
|
onMounted(() => {
|
|
54
|
-
watchEffect(
|
|
55
|
-
|
|
56
|
+
watchEffect((onCleanup) => {
|
|
57
|
+
const controller = new AbortController()
|
|
58
|
+
onCleanup(() => controller.abort())
|
|
59
|
+
void execute(controller.signal)
|
|
56
60
|
})
|
|
57
61
|
})
|
|
58
62
|
}
|
|
59
63
|
else {
|
|
60
|
-
watchEffect(
|
|
61
|
-
|
|
64
|
+
watchEffect((onCleanup) => {
|
|
65
|
+
const controller = new AbortController()
|
|
66
|
+
onCleanup(() => controller.abort())
|
|
67
|
+
void execute(controller.signal)
|
|
62
68
|
})
|
|
63
69
|
}
|
|
64
70
|
|