gramene-search 2.15.0 → 2.15.1
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/index.js +12 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6700,7 +6700,7 @@ const $85a9f6732ceb79db$var$savedViews = {
|
|
|
6700
6700
|
state: snapshot
|
|
6701
6701
|
})
|
|
6702
6702
|
});
|
|
6703
|
-
if (!res.ok) throw
|
|
6703
|
+
if (!res.ok) throw $85a9f6732ceb79db$var$savedViewsError('Save', res.status);
|
|
6704
6704
|
}
|
|
6705
6705
|
const shareUrl = $85a9f6732ceb79db$var$buildShareUrl(hash);
|
|
6706
6706
|
dispatch({
|
|
@@ -6748,7 +6748,7 @@ const $85a9f6732ceb79db$var$savedViews = {
|
|
|
6748
6748
|
});
|
|
6749
6749
|
if (res.status === 401) throw new Error('Sign in to load this private view.');
|
|
6750
6750
|
if (res.status === 404) throw new Error('Saved view not found (it may have been deleted).');
|
|
6751
|
-
if (!res.ok) throw
|
|
6751
|
+
if (!res.ok) throw $85a9f6732ceb79db$var$savedViewsError('Fetch', res.status);
|
|
6752
6752
|
row = await res.json();
|
|
6753
6753
|
}
|
|
6754
6754
|
const out = {
|
|
@@ -6802,7 +6802,7 @@ const $85a9f6732ceb79db$var$savedViews = {
|
|
|
6802
6802
|
const res = await fetch(url, {
|
|
6803
6803
|
headers: headers
|
|
6804
6804
|
});
|
|
6805
|
-
if (!res.ok) throw
|
|
6805
|
+
if (!res.ok) throw $85a9f6732ceb79db$var$savedViewsError('List', res.status);
|
|
6806
6806
|
rows = await res.json();
|
|
6807
6807
|
}
|
|
6808
6808
|
dispatch({
|
|
@@ -6846,7 +6846,7 @@ const $85a9f6732ceb79db$var$savedViews = {
|
|
|
6846
6846
|
},
|
|
6847
6847
|
body: JSON.stringify(updates)
|
|
6848
6848
|
});
|
|
6849
|
-
if (!res.ok) throw
|
|
6849
|
+
if (!res.ok) throw $85a9f6732ceb79db$var$savedViewsError('Update', res.status);
|
|
6850
6850
|
return res.json();
|
|
6851
6851
|
},
|
|
6852
6852
|
// DELETE one of my saved views. Mirrors deleteList.
|
|
@@ -6865,7 +6865,7 @@ const $85a9f6732ceb79db$var$savedViews = {
|
|
|
6865
6865
|
Authorization: `Bearer ${token}`
|
|
6866
6866
|
}
|
|
6867
6867
|
});
|
|
6868
|
-
if (!res.ok) throw
|
|
6868
|
+
if (!res.ok) throw $85a9f6732ceb79db$var$savedViewsError('Delete', res.status);
|
|
6869
6869
|
return res.json();
|
|
6870
6870
|
},
|
|
6871
6871
|
doResetSavedViewState: ()=>({ dispatch: dispatch })=>dispatch({
|
|
@@ -6882,6 +6882,13 @@ const $85a9f6732ceb79db$var$savedViews = {
|
|
|
6882
6882
|
}
|
|
6883
6883
|
};
|
|
6884
6884
|
// ── helpers ─────────────────────────────────────────────────────────────
|
|
6885
|
+
// A 405 on any saved_views call means the API route isn't deployed on this
|
|
6886
|
+
// backend — the request falls through to the read-only /{collection} handler.
|
|
6887
|
+
// Surface that as a clear, non-alarming message rather than a raw status code.
|
|
6888
|
+
function $85a9f6732ceb79db$var$savedViewsError(action, status) {
|
|
6889
|
+
if (status === 405) return new Error('Saved views are not available on this server yet.');
|
|
6890
|
+
return new Error(`${action} failed (${status})`);
|
|
6891
|
+
}
|
|
6885
6892
|
// Test/dev: either set the runtime-only flag (`window.__SAVED_VIEWS_MOCK__ = true`,
|
|
6886
6893
|
// cleared on reload), or persist via localStorage (`localStorage.setItem(
|
|
6887
6894
|
// '__SAVED_VIEWS_MOCK__', 'true')`, survives reloads — needed for the
|