pledge4future / WePledge

WebApp to calculate work related CO2e emissions from heating and electricity consumption as well as business trips and commuting.
https://pledge4future.org
GNU General Public License v3.0
6 stars 2 forks source link

Display Graphql Error messages from backend validation on sign-in and sign up forms #146

Open sami1riaz opened 2 years ago

sami1riaz commented 2 years ago

There are some validation scenarios that cannot be dealt with formik and require the proper graphql error message to be displayed on the front end:

codingfabi commented 2 years ago
redfrexx commented 2 years ago

I checked the GraphQL Django Auth docs and it seems like they don't have status codes implemented. Would it be enough to check the success variable in the response to see whether the query was successful or not? e.g. registration query

{
  "data": {
    "register": {
      "success": true,
      "errors": null
    }
  }
}
codingfabi commented 2 years ago

@sami1riaz I added some handling. of backend error messages for the changing of email functionality in https://github.com/pledge4future/WePledge/pull/174/commits/3027e687a7a1692fa944ff5fb1506faf6325230f. If you looking for some inspiration on how to deal with this problem :)