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
Create a generic component to update and insert SubCategories #78
Create a generic component to update and insert SubCategories #78
Conversation
29be4b5
to
c2fad36
Compare
c2fad36
to
84e037b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job @anjula-sack!
I think we can reuse the form too..
7441520
to
64e7f01
Compare
429fa9a
to
25b8582
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work @anjula-sack ,
Consider about the mentioned change requests
I think it's better if we could display the |
53df049
to
60eee6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to see that the component has improved a lot!
Added some comments, fix them too. :)
this.state = { | ||
isLoading: false, | ||
categories: [], | ||
subcategory: null, | ||
isComponentEdit: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of saving a boolean. Store the type which accepts only "add" and "edit"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it shouldn't be a state variable since you don't need to rerender the component when the component type changes. (the type isn't changing time to time)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes I will change it.
method = 'post'; | ||
url = '/core/academix/admin/sub-categories/'; | ||
} else { | ||
statusCode = 202; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should fix in the backend
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so what should I do until then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can fix the backend with this PR. It's a single line change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
{this.state.subcategory != null && | ||
this.subCategoryForm('Edit Subcategory')} | ||
{this.state.subcategory == null && | ||
this.subCategoryForm('Add Subcategory')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's better if you could use a generic string to the button.
What about "Save" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great.
Yes, it's good. But according to the use case, the users don't use IDs to identify a subcategory. We use it to programmatically identify it, but a normal user identifies a subcategory by its category's name and the subcategory name. So I think we don't need to display ids in the UI because it isn't informative data to the user. @YohanAvishke WDYT? |
60eee6e
to
6efbf56
Compare
6efbf56
to
b35671a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice job @anjula-sack !
Fix the following to improve the component.
2bbc9b3
to
0b87449
Compare
76f866a
to
d93eac8
Compare
d93eac8
to
3940c79
Compare
); | ||
}); | ||
}; | ||
render() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a space between functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
3940c79
to
e7c9d44
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @anjula-sack !
Purpose
Change the status code of PUT method response. #80
Goals
Approach
Checklist