Fix task poller callback staleness and normalize filings query
This commit is contained in:
18
lib/api.ts
18
lib/api.ts
@@ -153,11 +153,21 @@ export async function getLatestPortfolioInsight() {
|
||||
}
|
||||
|
||||
export async function listFilings(query?: { ticker?: string; limit?: number }) {
|
||||
const queryParams: {
|
||||
ticker?: string;
|
||||
limit?: number;
|
||||
} = {};
|
||||
|
||||
if (query?.ticker?.trim()) {
|
||||
queryParams.ticker = query.ticker.trim().toUpperCase();
|
||||
}
|
||||
|
||||
if (query?.limit !== undefined) {
|
||||
queryParams.limit = query.limit;
|
||||
}
|
||||
|
||||
const result = await client.api.filings.get({
|
||||
$query: {
|
||||
ticker: query?.ticker,
|
||||
limit: query?.limit
|
||||
}
|
||||
$query: queryParams
|
||||
});
|
||||
|
||||
return await unwrapData<{ filings: Filing[] }>(result, 'Unable to fetch filings');
|
||||
|
||||
Reference in New Issue
Block a user