fix(table): fixed resolution of query params & headers

This commit is contained in:
Waleed Latif
2025-02-18 14:36:14 -08:00
parent 2de52416d4
commit 3d132927bf
4 changed files with 43 additions and 12 deletions
+20
View File
@@ -0,0 +1,20 @@
import { TableRow } from './types'
/**
* Transforms a table from the store format to a key-value object
* @param table Array of table rows from the store
* @returns Record of key-value pairs
*/
export const transformTable = (table: TableRow[] | null): Record<string, string> => {
if (!table) return {}
return table.reduce(
(acc, row) => {
if (row.cells?.Key && row.cells?.Value !== undefined) {
acc[row.cells.Key] = row.cells.Value
}
return acc
},
{} as Record<string, string>
)
}