The current implementation of isValid has a bit of a nasty side-effect in that it formats the payload at the same time. Calling isValid should only do the necessary calculation. There is also some necessary logic that lingers in the serializer as well.
This refactor moves all of the munging logic for errors into a single location and performs the transformation as soon as the response comes back from the server. isValid now only performs the simple calculation to return the response as expected.
The current implementation of
isValid
has a bit of a nasty side-effect in that it formats thepayload
at the same time. CallingisValid
should only do the necessary calculation. There is also some necessary logic that lingers in the serializer as well.This refactor moves all of the munging logic for errors into a single location and performs the transformation as soon as the response comes back from the server.
isValid
now only performs the simple calculation to return the response as expected.