-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from Wemotive-POC/feature/homepage
Feature/homepage
- Loading branch information
Showing
16 changed files
with
911 additions
and
447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { getCall } from "./axios"; | ||
|
||
/** | ||
* function to get all products | ||
* @returns | ||
*/ | ||
export const getAllProductRequest = (data) => { | ||
const pageNumber = data.page+1; | ||
const limit = data.pageSize; | ||
const productName = data?.searchData?.productName || ""; | ||
const subCategoryName = data?.searchData?.subCategoryName || ""; | ||
return new Promise(async (resolve, reject) => { | ||
try { | ||
const quaryParams = `?limit=${limit}&pageNumber=${pageNumber}${subCategoryName?`&categoryIds=${subCategoryName}`:''}${productName?`&productName=${productName}`:""}` | ||
const data = await getCall(`/clientApis/v2/search${quaryParams}`); | ||
return resolve(data.response); | ||
} catch (err) { | ||
return reject(err); | ||
} | ||
}); | ||
}; | ||
|
||
/** | ||
* function to get all filters | ||
* @returns | ||
*/ | ||
export const getAllFiltersRequest = (subCatName) => { | ||
return new Promise(async (resolve, reject) => { | ||
try { | ||
const quaryParams = `?category=${subCatName}` | ||
const data = await getCall(`/clientApis/v2/attributes${quaryParams}`); | ||
return resolve(data.response); | ||
} catch (err) { | ||
return reject(err); | ||
} | ||
}); | ||
}; | ||
|
||
/** | ||
* function to get all filters | ||
* @returns | ||
*/ | ||
export const getAllFilterValuesRequest = (attributeCode, subCatName) => { | ||
return new Promise(async (resolve, reject) => { | ||
try { | ||
const quaryParams = `?attribute_code=${attributeCode}&category=${subCatName}` | ||
const data = await getCall(`/clientApis/v2/attributeValues${quaryParams}`); | ||
return resolve(data.response); | ||
} catch (err) { | ||
return reject(err); | ||
} | ||
}); | ||
}; |
Oops, something went wrong.