Skip to content
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

Adding ability to add new fruit via api #37

Open
4 tasks
Mirv opened this issue Nov 16, 2018 · 3 comments
Open
4 tasks

Adding ability to add new fruit via api #37

Mirv opened this issue Nov 16, 2018 · 3 comments

Comments

@Mirv
Copy link
Owner

Mirv commented Nov 16, 2018

Using object oriented practices to optimize for developer flow - prep before adding components to handle new

  • make a new file for the body container /app/assets/javascripts/components/_body.js.jsx

  • move the constructor into it from allfruits

  • move the component loading check from allfruits too

  • change main component to call body

@Mirv
Copy link
Owner Author

Mirv commented Nov 16, 2018

  • make a new component /app/assets/javascripts/components/_new_item.js.jsx to handle the form fields

  • add form submitting function toBody class

  • bind new function to the current object from the the constructor in Body class

  • have render of Body class bind the function to the component form link

  • add an onSubmit function the NewFruit class

  • test when on submit is called for login & prompt to login (temporarily the page login before js interface is standalone)

NewFruit is now called, rendered and submits to class above it - but class above needs to handle the newly acquired data.

  • body needs to have handleFormSubmit fleshed out

  • body needs to have a fetch request formed to send to the API

  • body needs to have a function (addNewFruit) to reflect the fruit list

@Mirv
Copy link
Owner Author

Mirv commented Nov 21, 2018

// either pass form state check to display or not up or if statement check here
// Eventually go to stateful collection with dumb form fields
// .. where form handling pushes up one level

@Mirv
Copy link
Owner Author

Mirv commented Nov 27, 2018

Adding i18n translation and locality

  • error message in app/config/locales/en.yml
  • error title
  • error human readable details
  • define call to error in ActionController::API
  • create class file in app/models
  • expose identifier & status
  • handle initialization
  • define the response format for json (status, code, title, detail)
  • define translated_payload to call to the I18n module method translate
  • have controller action spit out the the errors in json if .save on resource fails
  • pre action authorization check should call to render_error_payload with error & status :forbidden)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant