bugfixing

This commit is contained in:
MuslemRahimi 2024-10-31 14:13:31 +01:00
parent fc64088ee4
commit ac5971d679
2 changed files with 7 additions and 11 deletions

View File

@ -165,23 +165,19 @@
const onKeyPress = (e) => {
if (e?.charCode === 13) {
focusedSuggestion = "";
const assetActions = {
ETF: () => goto(`/etf/${searchQuery}`),
Stock: () => goto(`/stocks/${searchQuery}`),
Crypto: () => goto(`/crypto/${searchQuery}`),
};
if (showSuggestions?.length > 0) {
// Use the first search result
searchQuery = firstResult.symbol;
assetType = firstResult.type;
if (searchResults?.length > 0) {
searchQuery = searchResults.at(0).symbol;
assetType = searchResults.at(0).type;
}
// Execute the appropriate action for the asset type
if (assetActions[assetType]) {
assetActions[assetType]();
}
// Call the function for the selected asset type
assetActions[assetType]?.();
// Trigger search bar action
searchBarTicker(searchQuery);

View File

@ -124,8 +124,8 @@
100
)?.toFixed(2);
priceTarget =
data?.getAnalystRating?.priceTarget !== ("n/a" && 0)
? data?.getAnalystRating?.priceTarget
data?.getAnalystRating?.medianPriceTarget !== ("n/a" && 0)
? data?.getAnalystRating?.medianPriceTarget
: "-";
consensusRating = data?.getAnalystRating?.consensusRating;