Skip to content

Commit

Permalink
[zis] add products for categories excepts phones
Browse files Browse the repository at this point in the history
  • Loading branch information
ZIS committed Aug 11, 2021
1 parent ca89a4b commit 1ffe93a
Show file tree
Hide file tree
Showing 23 changed files with 269 additions and 1,779 deletions.
2 changes: 2 additions & 0 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ export function getProductBySlug (slug, authToken) {
export function getCategoryProducts (currentCategory, specialCategories, subCategories, authToken) {
const requestConfig = {
name: 'getCategoryProducts',
categoryId: (currentCategory ? currentCategory.id : null),
url: getUrlFromTemplate(API.PRODUCTS_BY_CATEGORY, {categoryId: (currentCategory ? currentCategory.id : null)}),
params: {
special_categories: map(specialCategories, 'id'),
Expand All @@ -222,6 +223,7 @@ export function getCategoryProducts (currentCategory, specialCategories, subCate
export function getSpecialCategoryProducts (specialCategory, currentCategory, authToken, from, take, brandId) {
const requestConfig = {
name: 'getSpecialCategoryProducts',
categoryId: specialCategory.id,
url: getUrlFromTemplate(API.PRODUCTS_BY_CATEGORY, {categoryId: specialCategory.id}),
params: {
context_id: (currentCategory ? currentCategory.id : null),
Expand Down
6 changes: 2 additions & 4 deletions api/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,10 @@ export function callMockApi (requestConfig) {
// return getProductBySlug()
return callApi(requestConfig)
case 'getCategoryProducts':
return getCategoryProducts()
return getCategoryProducts(requestConfig)
// return callApi(requestConfig)
case 'getSpecialCategoryProducts':
console.log('am i getting called?')
console.log('getCategoryProducts', getCategoryProducts())
return getCategoryProducts()
return getCategoryProducts(requestConfig)
// return callApi(requestConfig)
case 'createOtp':
// return createOtp()
Expand Down
44 changes: 36 additions & 8 deletions api/mock/products/getCategoryProducts.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
import product10111 from '~/api/mock/products/product11/product10111.json'
import product10112 from '~/api/mock/products/product11/product10112.json'
import product10113 from '~~/api/mock/products/product11/product10113.json'
import product10114 from '~/api/mock/products/product11/product10114.json'
// import { getCategoryProducts } from '../../mock'
import product10111 from '~/api/mock/products/product10/product10111.json'
import product10112 from '~/api/mock/products/product10/product10112.json'
import product10113 from '~/api/mock/products/product10/product10113.json'
import product10114 from '~/api/mock/products/product10/product10114.json'
import product10121 from '~/api/mock/products/product10/product10121.json'
import product10122 from '~/api/mock/products/product10/product10122.json'
import product10123 from '~/api/mock/products/product10/product10123.json'
import product10124 from '~/api/mock/products/product10/product10124.json'

const products = [product10111, product10112, product10113, product10114]
import product20001 from '~/api/mock/products/product20/product20001.json'
import product20002 from '~/api/mock/products/product20/product20002.json'
import product20003 from '~/api/mock/products/product20/product20003.json'
import product20004 from '~/api/mock/products/product20/product20004.json'

export function getCategoryProducts () {
return products
const products = [
product10111,
product10112,
product10113,
product10114,
product10121,
product10122,
product10123,
product10124,
product20001,
product20002,
product20003,
product20004
]

function getProductByCategoryId (id) {
return products.filter(prod => prod.categoryId === id)
}

export function getCategoryProducts ({ categoryId }) {
const categoryProducts = {}

categoryProducts[categoryId] = getProductByCategoryId(categoryId)
return categoryProducts
}

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"variant_count": 2,
"categoryId": 255,
"slug":"zayyan-mixed-cotton-contrast-panjabi",
"meta":[

Expand All @@ -25,6 +26,7 @@
],
"variants":[
{
"categoryId": 255,
"id":78662,
"variant_slug":"m-2462",
"status":1,
Expand Down Expand Up @@ -146,6 +148,7 @@
},
{
"id":78663,
"categoryId": 255,
"variant_slug":"l-2505",
"status":1,
"created_at":"2020-07-19T14:26:57+06:00",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id":56225,
"categoryId": 255,
"name":{
"en":"Men\u2019s Fashionable Panjabi-HH005"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id":56283,
"categoryId": 255,
"name":{
"en":"Men\u2019s Fashionable Panjabi-HH010"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id":78595,
"categoryId": 255,
"name":{
"en":"ZAYYAN Contrast Red & White Stripe Cotton Panjabi",
"bn":"ZAYYAN Contrast Red & White Stripe Cotton Panjabi"
Expand Down
684 changes: 27 additions & 657 deletions api/mock/products/product10/product10121.json

Large diffs are not rendered by default.

384 changes: 24 additions & 360 deletions api/mock/products/product10/product10122.json

Large diffs are not rendered by default.

617 changes: 27 additions & 590 deletions api/mock/products/product10/product10123.json

Large diffs are not rendered by default.

187 changes: 27 additions & 160 deletions api/mock/products/product10/product10124.json

Large diffs are not rendered by default.

31 changes: 31 additions & 0 deletions api/mock/products/product20/product20001.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"id":11402,
"categoryId": 207,
"name":{
"en":"Khero Khata Salfet Green",
"bn":"\u0996\u09c7\u09b0\u09cb \u0996\u09be\u09a4\u09be - \u09b8\u09be\u09b2\u09ab\u09c7\u099f \u0997\u09cd\u09b0\u09bf\u09a8"
},
"slug":"khero-khata-salfet-green",
"variant_slug":null,
"emi_tenures":[],
"image_info":[
{
"url":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/25070\/product-11402.jpeg",
"width":800,
"srcset":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/25070\/responsive-images\/product-11402___medialibrary_original_800_600.jpeg 800w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/25070\/responsive-images\/product-11402___medialibrary_original_669_501.jpeg 669w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/25070\/responsive-images\/product-11402___medialibrary_original_560_420.jpeg 560w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/25070\/responsive-images\/product-11402___medialibrary_original_468_351.jpeg 468w",
"thumbnail":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/25070\/responsive-images\/product-11402___medialibrary_original_468_351.jpeg"
}
],
"coupon_details":null,
"discounted_price":220,
"unit_price":220,
"available_qty":2,
"out_of_stock":false,
"varies_on":[

],
"variant_count":0,
"commission":null,
"primary_variant_id":null,
"offers":[]
}
29 changes: 29 additions & 0 deletions api/mock/products/product20/product20002.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"id":11385,
"categoryId": 207,
"name":{
"en":"Khero Khata Vinci-Monalisa",
"bn":"\u0996\u09c7\u09b0\u09cb \u0996\u09be\u09a4\u09be - \u09ad\u09bf\u099e\u09cd\u099a\u09bf \u09ae\u09cb\u09a8\u09be\u09b2\u09bf\u09b8\u09be"
},
"slug":"khero-khata-vinci-monalisa",
"variant_slug":null,
"emi_tenures":[],
"image_info":[
{
"url":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/49720\/product-11385.jpeg",
"width":800,
"srcset":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/49720\/responsive-images\/product-11385___medialibrary_original_800_600.jpeg 800w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/49720\/responsive-images\/product-11385___medialibrary_original_669_501.jpeg 669w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/49720\/responsive-images\/product-11385___medialibrary_original_560_420.jpeg 560w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/49720\/responsive-images\/product-11385___medialibrary_original_468_351.jpeg 468w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/49720\/responsive-images\/product-11385___medialibrary_original_391_293.jpeg 391w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/49720\/responsive-images\/product-11385___medialibrary_original_327_245.jpeg 327w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/49720\/responsive-images\/product-11385___medialibrary_original_274_205.jpeg 274w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/49720\/responsive-images\/product-11385___medialibrary_original_229_171.jpeg 229w",
"thumbnail":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/49720\/responsive-images\/product-11385___medialibrary_original_468_351.jpeg"
}
],
"coupon_details":null,
"discounted_price":90,
"unit_price":90,
"available_qty":2,
"out_of_stock":false,
"varies_on":[],
"variant_count":0,
"commission":null,
"primary_variant_id":null,
"offers":[]
}
29 changes: 29 additions & 0 deletions api/mock/products/product20/product20003.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"id":1407,
"categoryId": 207,
"name":{
"en":"Khero Khata 26 March Terracota",
"bn":"\u0996\u09c7\u09b0\u09cb \u0996\u09be\u09a4\u09be - \u09e8\u09ec \u09ae\u09be\u09b0\u09cd\u099a \u099f\u09c7\u09b0\u09be\u0995\u09cb\u099f\u09be"
},
"slug":"khero-khata-26-march-terracota",
"variant_slug":null,
"emi_tenures":[],
"image_info":[
{
"url":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/product-1407.jpg",
"width":800,
"srcset":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/responsive-images\/product-1407___medialibrary_original_800_600.jpg 800w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/responsive-images\/product-1407___medialibrary_original_669_501.jpg 669w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/responsive-images\/product-1407___medialibrary_original_560_420.jpg 560w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/responsive-images\/product-1407___medialibrary_original_468_351.jpg 468w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/responsive-images\/product-1407___medialibrary_original_391_293.jpg 391w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/responsive-images\/product-1407___medialibrary_original_327_245.jpg 327w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/responsive-images\/product-1407___medialibrary_original_274_205.jpg 274w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/responsive-images\/product-1407___medialibrary_original_229_171.jpg 229w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/responsive-images\/product-1407___medialibrary_original_192_144.jpg 192w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/responsive-images\/product-1407___medialibrary_original_160_120.jpg 160w",
"thumbnail":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2878\/responsive-images\/product-1407___medialibrary_original_468_351.jpg"
}
],
"coupon_details":null,
"discounted_price":350,
"unit_price":350,
"available_qty":2,
"out_of_stock":false,
"varies_on":[],
"variant_count":0,
"commission":null,
"primary_variant_id":null,
"offers":[]
}
29 changes: 29 additions & 0 deletions api/mock/products/product20/product20004.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"id":1416,
"categoryId": 207,
"name":{
"en":"Khero Khata-Tareq Masud",
"bn":"\u0996\u09c7\u09b0\u09cb \u0996\u09be\u09a4\u09be- \u09a4\u09be\u09b0\u09c7\u0995 \u09ae\u09be\u09b8\u09c1\u09a6"
},
"slug":"kharu-khata-tareq-masud",
"variant_slug":null,
"emi_tenures":[],
"image_info":[
{
"url":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2887\/product-1416.jpg",
"width":800,
"srcset":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2887\/responsive-images\/product-1416___medialibrary_original_800_600.jpg 800w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2887\/responsive-images\/product-1416___medialibrary_original_669_501.jpg 669w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2887\/responsive-images\/product-1416___medialibrary_original_560_420.jpg 560w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2887\/responsive-images\/product-1416___medialibrary_original_468_351.jpg 468w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2887\/responsive-images\/product-1416___medialibrary_original_391_293.jpg 391w, https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2887\/responsive-images\/product-1416___medialibrary_original_327_245.jpg 327w",
"thumbnail":"https:\/\/d1zk0te1r027w9.cloudfront.net\/storage\/media\/2887\/responsive-images\/product-1416___medialibrary_original_468_351.jpg"
}
],
"coupon_details":null,
"discounted_price":180,
"unit_price":180,
"available_qty":7,
"out_of_stock":false,
"varies_on":[],
"variant_count":0,
"commission":null,
"primary_variant_id":null,
"offers":[]
}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.

0 comments on commit 1ffe93a

Please sign in to comment.