dwyl / mvp

📲 simplest version of the @dwyl app
https://mvp.fly.dev
GNU General Public License v2.0
84 stars 2 forks source link

Add changeset validation on item form #212

Open SimonLab opened 1 year ago

SimonLab commented 1 year ago

https://github.com/dwyl/mvp/blob/91d76ecf8d08dd85c452b768f9d3143432158573/lib/app_web/live/app_live.ex#L34-L46

The Item.create_item_with_tag function will return {:ok, item} or {:error, changeset}. Currently we are not checking if an error occurs. We can test this by creating an item where the text only container spaces. The item it not created but the user doesn't get any feedback.

I'm going to look at adding the changeset to the form. This will also help me once the changeset is linked to the form with #201 as I will be able to add tags dynamically to the changeset when selected.

SimonLab commented 1 year ago

At the end I'm not using the changeset in the form: https://github.com/dwyl/mvp/pull/209/files#diff-59b6eab9140cffaf2f252c0ae8a634274500b7f7922495151054fe029e7aba1fR2-R6