-
Notifications
You must be signed in to change notification settings - Fork 0
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 #1 from zafree/zis-mock-products
Added mock products and get the products by category feature
- Loading branch information
Showing
25 changed files
with
681 additions
and
1,783 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
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
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,40 @@ | ||
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' | ||
|
||
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' | ||
|
||
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 | ||
} | ||
|
Oops, something went wrong.