Updated error handling

This commit is contained in:
pepper 2021-01-19 01:25:01 -05:00
parent 7aea3080b6
commit faab2fd921

View File

@ -5,7 +5,7 @@ import { Formik, Form } from "formik";
import { Input, Submit } from "formstrap";
import { callAPI } from "../../../actions/API";
import Msgbox from "../../../actions/Msgbox";
import { buildErrorStringFromArray } from "../../../actions/Error";
import { builfArrayFromObject } from "../../../actions/Error";
// Main form element for the UUID linking Migrations page,
// Contians the PUT request to modify data from the API
@ -38,11 +38,11 @@ const ReportSingleMigration = ({ item }) => {
.then(function (response) {
console.log(JSON.stringify(response.values));
setRespID(response.data.ticket_id);
setError(0)
setError(0);
})
.catch(function (error) {
setError(buildErrorStringFromArray(error.response.data));
setRespID(0)
setError(builfArrayFromObject(error.response.data));
setRespID(0);
});
setSubmitting(false);
};