mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
Fix timelines
This commit is contained in:
parent
8c870cdad3
commit
0a74bbfe93
7 changed files with 22 additions and 13 deletions
|
|
@ -11,6 +11,7 @@ export async function parseRequest<T>(request: Request): Promise<Partial<T>> {
|
|||
|
||||
// Parse SearchParams arrays into JSON arrays
|
||||
const arrayKeys = [...query.keys()].filter(key => key.endsWith("[]"));
|
||||
const nonArrayKeys = [...query.keys()].filter(key => !key.endsWith("[]"));
|
||||
|
||||
for (const key of arrayKeys) {
|
||||
const value = query.getAll(key);
|
||||
|
|
@ -18,6 +19,12 @@ export async function parseRequest<T>(request: Request): Promise<Partial<T>> {
|
|||
query.append(key, JSON.stringify(value));
|
||||
}
|
||||
|
||||
// Append non array keys to output
|
||||
for (const key of nonArrayKeys) {
|
||||
// @ts-expect-error Complains about type
|
||||
output[key] = query.get(key);
|
||||
}
|
||||
|
||||
const queryEntries = [...query.entries()];
|
||||
|
||||
if (queryEntries.length > 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue