diff options
| author | trisusilo <tri.susilo@altama.co.id> | 2023-10-09 03:48:41 +0000 |
|---|---|---|
| committer | trisusilo <tri.susilo@altama.co.id> | 2023-10-09 03:48:41 +0000 |
| commit | 5ab25c12716065421e64fcd91403bce31708eea6 (patch) | |
| tree | b3979bcf815686565fc5d672873c01eb552cbe31 /src/pages/api | |
| parent | 397e589d7cbd927a3d3e62a1aade1deff1124af5 (diff) | |
| parent | 591dc095a0e5f655e419ec4d1ae11d8f54bed196 (diff) | |
Merged in CR/Pricelist (pull request #96)
CR/Pricelist
Diffstat (limited to 'src/pages/api')
| -rw-r--r-- | src/pages/api/shop/variant-detail.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/pages/api/shop/variant-detail.js b/src/pages/api/shop/variant-detail.js new file mode 100644 index 00000000..fadbe000 --- /dev/null +++ b/src/pages/api/shop/variant-detail.js @@ -0,0 +1,18 @@ +import { productMappingSolr, variantsMappingSolr } from '@/utils/solrMapping' +import axios from 'axios' + +export default async function handler(req, res) { + try { + let productVariants = await axios( + process.env.SOLR_HOST + + `/solr/variants/select?q=id:${req.query.id}&q.op=OR&indent=true` + ) + let auth = req.query.auth === 'false' ? JSON.parse(req.query.auth) : req.query.auth + let result = variantsMappingSolr('',productVariants.data.response.docs, auth || false) + + res.status(200).json(result) + } catch (error) { + console.error('Error fetching data from Solr:', error) + res.status(500).json({ error: 'Internal Server Error' }) + } +}
\ No newline at end of file |
