-
Notifications
You must be signed in to change notification settings - Fork 2
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
Added users backend and fetched them in the dropdown #38
base: main
Are you sure you want to change the base?
Conversation
Hey @girijaasoni, I created a PR to better test our frontend code in #42 |
639b786
to
8fdd3ba
Compare
sorry, wrong push 🤣 but now it's rebased |
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 work @girijaasoni !
one concern is that we save the Article.creator
as a string nor as a reference to the User
model.
{users.map((user) => ( | ||
<DropdownItem key="group 1 action" component="button"> |
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.
can you use the user.id
as a key?
currently there's an error:
Warning: Each child in a list should have a unique "key" prop.
const handleChange = (value, key) => { | ||
setData({ | ||
...data, | ||
[key]: value | ||
}); | ||
}; | ||
const onToggle = (isDropdownOpen) => { |
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.
as a convention, in Foreman we use 'handleToggle' instead of 'onToggle'
</Button>{' '} | ||
<PfButton | ||
variant="link" | ||
icon={<PlusCircleIcon />} |
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! looks better.
@@ -1,4 +1,5 @@ | |||
Rails.application.routes.draw do | |||
resources :users |
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.
can you move it below the root route?
const onSelect = (event) => { | ||
const value = event.target.innerHTML; | ||
setSelectedUser(value); |
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 passing the string value of the user name,
can you pass the ID of the user? and also link in the database the Article.creator
to User
?
const onSelect = (event) => { | ||
const value = event.target.innerHTML; | ||
setSelectedUser(value); |
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 passing the string value of the user name,
can you pass the ID of the user? and also link in the database the Article.creator
to User
?
6c05375
to
a01bcd7
Compare
No description provided.