@liberfi.io/react-predict 0.3.63 → 0.3.65
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.d.mts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -9
- package/dist/index.mjs.map +1 -1
- package/dist/{server-Dk8PqvnI.d.mts → server-pS5Vlydo.d.mts} +10 -3
- package/dist/{server-Dk8PqvnI.d.ts → server-pS5Vlydo.d.ts} +10 -3
- package/dist/server.d.mts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +6 -6
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +6 -6
- package/dist/server.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -58,8 +58,8 @@ var PredictClient = class {
|
|
|
58
58
|
* @returns The matching event.
|
|
59
59
|
* @throws When the server responds with 404 or any other non-2xx status.
|
|
60
60
|
*/
|
|
61
|
-
async getEvent(slug, source) {
|
|
62
|
-
const query =
|
|
61
|
+
async getEvent(slug, source, params) {
|
|
62
|
+
const query = buildQuery({ source, ...params });
|
|
63
63
|
const url = `${this.endpoint}/api/v1/events/${encodeURIComponent(slug)}${query}`;
|
|
64
64
|
return await httpGet(url, this.requestOptions());
|
|
65
65
|
}
|
|
@@ -1202,19 +1202,19 @@ function infiniteEventsQueryKey(params) {
|
|
|
1202
1202
|
async function fetchEventsPage(client, params) {
|
|
1203
1203
|
return client.listEvents(params);
|
|
1204
1204
|
}
|
|
1205
|
-
function eventQueryKey(slug, source) {
|
|
1206
|
-
return ["predict", "event", slug, source];
|
|
1205
|
+
function eventQueryKey(slug, source, lang) {
|
|
1206
|
+
return ["predict", "event", slug, source, lang];
|
|
1207
1207
|
}
|
|
1208
|
-
async function fetchEvent(client, slug, source) {
|
|
1209
|
-
return client.getEvent(slug, source);
|
|
1208
|
+
async function fetchEvent(client, slug, source, lang) {
|
|
1209
|
+
return client.getEvent(slug, source, { lang });
|
|
1210
1210
|
}
|
|
1211
1211
|
|
|
1212
1212
|
// src/hooks/predict/useEvent.ts
|
|
1213
1213
|
function useEvent(params, queryOptions = {}) {
|
|
1214
1214
|
const client = usePredictClient();
|
|
1215
1215
|
return useQuery({
|
|
1216
|
-
queryKey: eventQueryKey(params.slug, params.source),
|
|
1217
|
-
queryFn: () => fetchEvent(client, params.slug, params.source),
|
|
1216
|
+
queryKey: eventQueryKey(params.slug, params.source, params.lang),
|
|
1217
|
+
queryFn: () => fetchEvent(client, params.slug, params.source, params.lang),
|
|
1218
1218
|
enabled: Boolean(params.slug),
|
|
1219
1219
|
...queryOptions
|
|
1220
1220
|
});
|
|
@@ -1287,7 +1287,8 @@ function useSimilarEvents(params, queryOptions = {}) {
|
|
|
1287
1287
|
const client = usePredictClient();
|
|
1288
1288
|
const apiParams = {
|
|
1289
1289
|
limit: params.limit,
|
|
1290
|
-
same_source: params.same_source
|
|
1290
|
+
same_source: params.same_source,
|
|
1291
|
+
lang: params.lang
|
|
1291
1292
|
};
|
|
1292
1293
|
return useQuery({
|
|
1293
1294
|
queryKey: similarEventsQueryKey(params.slug, params.source, apiParams),
|