-
Notifications
You must be signed in to change notification settings - Fork 3
Implement edit and delete feature for products #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
spaceman03
wants to merge
16
commits into
main
Choose a base branch
from
merch-products/zhixuan
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
d0c3ff4
Implemented edit and delete feature for products
spaceman03 e8d372e
Fix lint issue
spaceman03 04c5484
Fix lint issue
spaceman03 9919a34
Fix lint issue
spaceman03 c8ab473
Fix lint issue
spaceman03 3bad8ee
Fix lint issue
spaceman03 955fd71
Fix lint issue
spaceman03 4ad7639
Fix lint issue
spaceman03 7cc2d64
Fix lint issue
spaceman03 86c8b93
Fix lint issue
spaceman03 f82ffaf
Revert changes on products api
spaceman03 09a2437
Fix lint issue
spaceman03 8b9da27
Fix error
spaceman03 093c368
Fix error
spaceman03 d8dad27
Fix error
spaceman03 3a2101c
Fix error
spaceman03 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,10 @@ | ||
| export class Product { | ||
| constructor( | ||
| public id = '', | ||
| public name = '', | ||
| public colors= '', | ||
| public sizes = '', | ||
| public price = '', | ||
| public category = '' | ||
| ) { } | ||
| } |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,64 +1,63 @@ | ||
| import { Product } from "types"; | ||
| // todo turn into real api | ||
| class ProductsApi { | ||
| // eslint-disable-next-line @typescript-eslint/require-await | ||
| async getProducts(): Promise<any> { | ||
| const res: Product[] = [ | ||
| { | ||
| id: "1", | ||
| name: "product1", | ||
| price: 1000, | ||
| images: [ | ||
| "https://i.kym-cdn.com/entries/icons/original/000/033/421/cover2.jpg", | ||
| "https://i.pinimg.com/474x/c0/f9/f1/c0f9f10a0061a8dd1080d7d9e560579c.jpg", | ||
| ], | ||
| sizes: ["s", "m", "l", "xl"], | ||
| category: "shirt", | ||
| is_available: true, | ||
| colors: ["black,white,blue"], | ||
| stock: { | ||
| black: { S: 10, M: 15, L: 20, XL: 5 }, | ||
| white: { S: 12, M: 17, L: 22, XL: 7 }, | ||
| blue: { S: 8, M: 13, L: 18, XL: 3 } | ||
| // eslint-disable-next-line @typescript-eslint/require-await | ||
| async getProducts(): Promise<any> { | ||
| const res: Product[] = [ | ||
| { | ||
| id: "1", | ||
| name: "product1", | ||
| price: 1000, | ||
| images: [ | ||
| "https://i.kym-cdn.com/entries/icons/original/000/033/421/cover2.jpg", | ||
| "https://i.pinimg.com/474x/c0/f9/f1/c0f9f10a0061a8dd1080d7d9e560579c.jpg", | ||
| ], | ||
| sizes: ["s", "m", "l", "xl"], | ||
| category: "shirt", | ||
| is_available: true, | ||
| colors: ["black,white,blue"], | ||
| stock: { | ||
| black: { S: 10, M: 15, L: 20, XL: 5 }, | ||
| white: { S: 12, M: 17, L: 22, XL: 7 }, | ||
| blue: { S: 8, M: 13, L: 18, XL: 3 } | ||
| }, | ||
| }, | ||
| { | ||
| id: "2", | ||
| name: "product2", | ||
| price: 2000, | ||
| images: [ | ||
| "https://i.kym-cdn.com/photos/images/newsfeed/002/164/493/b8b.jpg", | ||
| "https://i.kym-cdn.com/entries/icons/original/000/033/421/cover2.jpg", | ||
| ], | ||
| sizes: ["s", "m"], | ||
| category: "sweater", | ||
| is_available: true, | ||
| colors: ["blue"], | ||
| stock: { | ||
| blue: { S: 8, M: 13, L: 18, XL: 3 } | ||
| { | ||
| id: "2", | ||
| name: "product2", | ||
| price: 2000, | ||
| images: [ | ||
| "https://i.kym-cdn.com/photos/images/newsfeed/002/164/493/b8b.jpg", | ||
| "https://i.kym-cdn.com/entries/icons/original/000/033/421/cover2.jpg", | ||
| ], | ||
| sizes: ["s", "m"], | ||
| category: "sweater", | ||
| is_available: true, | ||
| colors: ["blue"], | ||
| stock: { | ||
| blue: { S: 8, M: 13, L: 18, XL: 3 } | ||
| }, | ||
| }, | ||
| { | ||
| id: "3", | ||
| name: "product3", | ||
| price: 3000, | ||
| images: [ | ||
| "https://i.kym-cdn.com/entries/icons/original/000/033/421/cover2.jpg", | ||
| "https://i.kym-cdn.com/photos/images/newsfeed/002/164/493/b8b.jpg", | ||
| "https://i.pinimg.com/474x/c0/f9/f1/c0f9f10a0061a8dd1080d7d9e560579c.jpg", | ||
| ], | ||
| sizes: ["xs", "s", "m", "l"], | ||
| category: "hat", | ||
| is_available: false, | ||
| colors: ["white"], | ||
| stock: { | ||
| white: { S: 12, M: 17, L: 22, XL: 7 } | ||
| { | ||
| id: "3", | ||
| name: "product3", | ||
| price: 3000, | ||
| images: [ | ||
| "https://i.kym-cdn.com/entries/icons/original/000/033/421/cover2.jpg", | ||
| "https://i.kym-cdn.com/photos/images/newsfeed/002/164/493/b8b.jpg", | ||
| "https://i.pinimg.com/474x/c0/f9/f1/c0f9f10a0061a8dd1080d7d9e560579c.jpg", | ||
| ], | ||
| sizes: ["xs", "s", "m", "l"], | ||
| category: "hat", | ||
| is_available: false, | ||
| colors: ["white"], | ||
| stock: { | ||
| white: { S: 12, M: 17, L: 22, XL: 7 } | ||
| }, | ||
| }, | ||
| ]; | ||
|
|
||
| return res; | ||
| }, | ||
| ]; | ||
| return res; | ||
| } | ||
| } | ||
|
|
||
| export default new ProductsApi(); | ||
| export default new ProductsApi(); |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.