evikit 2.7.1 → 2.7.3
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/index.js +7 -2
- package/package.json +1 -1
- package/server.js +24 -7
package/index.js
CHANGED
|
@@ -96,14 +96,19 @@ export function Router({ children, dehydratedState, i18n }) {
|
|
|
96
96
|
* @param {{ lang?: string, url: string }} data
|
|
97
97
|
*/
|
|
98
98
|
export async function ssr(App, data) {
|
|
99
|
-
const origin = process.env["ORIGIN"] || "http://localhost:5173";
|
|
100
99
|
const i18n = await getI18n(...(data.lang ? [data.lang] : []));
|
|
101
100
|
|
|
102
101
|
const queryClient = new QueryClient({
|
|
103
102
|
defaultOptions: { queries: { staleTime: 0 } },
|
|
104
103
|
});
|
|
105
104
|
await queryClient.prefetchQuery(
|
|
106
|
-
queryApi({
|
|
105
|
+
queryApi({
|
|
106
|
+
lang: i18n.getLocale(),
|
|
107
|
+
origin:
|
|
108
|
+
process.env["ORIGIN"] ||
|
|
109
|
+
`http://localhost:${Number(process.env["PORT"]) || 5173}`,
|
|
110
|
+
path: data.url,
|
|
111
|
+
}),
|
|
107
112
|
);
|
|
108
113
|
const dehydratedState = dehydrate(queryClient, {
|
|
109
114
|
shouldRedactErrors: (error) => {
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -338,12 +338,27 @@ export function router({ pkg }, ...routes) {
|
|
|
338
338
|
return [
|
|
339
339
|
method,
|
|
340
340
|
{
|
|
341
|
-
parameters:
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
341
|
+
parameters: [
|
|
342
|
+
...parameters.map((name) => ({
|
|
343
|
+
in: "path",
|
|
344
|
+
name,
|
|
345
|
+
required: true,
|
|
346
|
+
schema: { type: "string" },
|
|
347
|
+
})),
|
|
348
|
+
...(method == "post"
|
|
349
|
+
? []
|
|
350
|
+
: Object.entries(input.entries)
|
|
351
|
+
.filter(
|
|
352
|
+
([name]) =>
|
|
353
|
+
name != "lang" && !parameters.includes(name),
|
|
354
|
+
)
|
|
355
|
+
.map(([name, entry]) => ({
|
|
356
|
+
in: "query",
|
|
357
|
+
name,
|
|
358
|
+
required: !entry.expects.includes("undefined"),
|
|
359
|
+
schema: { type: "string" },
|
|
360
|
+
}))),
|
|
361
|
+
],
|
|
347
362
|
...(method == "post"
|
|
348
363
|
? {
|
|
349
364
|
requestBody: {
|
|
@@ -358,7 +373,9 @@ export function router({ pkg }, ...routes) {
|
|
|
358
373
|
object(
|
|
359
374
|
Object.fromEntries(
|
|
360
375
|
Object.entries(input.entries).filter(
|
|
361
|
-
([name]) =>
|
|
376
|
+
([name]) =>
|
|
377
|
+
name != "lang" &&
|
|
378
|
+
!parameters.includes(name),
|
|
362
379
|
),
|
|
363
380
|
),
|
|
364
381
|
),
|