This commit is contained in:
@@ -85,13 +85,22 @@
|
||||
}
|
||||
)
|
||||
|
||||
const getNormalizedQuery = () => {
|
||||
const query: Record<string, unknown> = {}
|
||||
const getNormalizedQuery = (): Record<string, string> => {
|
||||
const query: Record<string, string> = {}
|
||||
|
||||
Object.entries(props.query || {}).forEach(([key, value]) => {
|
||||
if (value === undefined || value === null || value === '') return
|
||||
if (Array.isArray(value) && value.length === 0) return
|
||||
query[key] = value
|
||||
|
||||
if (typeof value === 'string') {
|
||||
query[key] = value
|
||||
} else if (typeof value === 'number' || typeof value === 'boolean') {
|
||||
query[key] = String(value)
|
||||
} else if (Array.isArray(value)) {
|
||||
query[key] = value.join(',')
|
||||
} else {
|
||||
query[key] = JSON.stringify(value)
|
||||
}
|
||||
})
|
||||
|
||||
return query
|
||||
|
||||
Reference in New Issue
Block a user