diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-08-15 07:22:06 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-08-15 07:22:06 +0000 |
| commit | 492e4a875ec7259be80bb4b501bc62e7afa0c9c7 (patch) | |
| tree | d711f0109795b9a49bc5c30f986e9ee429a2171e /src-migrate/services | |
| parent | 9d16a4a7f15ce7fe89ff1d451f567064d5030c2f (diff) | |
| parent | 4fb570559e293d506819059ce42836562a2fb4d2 (diff) | |
Merged in Feature/template-switch (pull request #240)
<iman> update search product using name
Diffstat (limited to 'src-migrate/services')
| -rw-r--r-- | src-migrate/services/product.ts | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src-migrate/services/product.ts b/src-migrate/services/product.ts index 2152ba26..a5039ad9 100644 --- a/src-migrate/services/product.ts +++ b/src-migrate/services/product.ts @@ -76,8 +76,13 @@ export const getProductSimilar = async ({ dataflashSale = dataflashSale } } + + const regex = /\b(?![A-Z\s]+\b)[A-Za-z\s]+\b/g; + const matches = name?.match(regex); + const extractedName = matches ? matches.join(' ').trim() : ''; + console.log("extractedName",extractedName); const query = [ - `q=${name}`, + `q=${extractedName}`, 'page=1', 'orderBy=popular-weekly', 'operation=OR', |
