-
Notifications
You must be signed in to change notification settings - Fork 35
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
Add error treatment to apiUmbrellaWeb[...].createApiBackend - closes #357 #527
Conversation
If I get an error, server console says this: What is this [object Object]? |
229a7de
to
4a815ee
Compare
|
@mauriciovieira, let me know when PR is ready to be reviewed by removing WIP label. |
@bajiat I am trying to fix this as @elnzv commented. |
@@ -1,10 +1,43 @@ | |||
AutoForm.hooks({ | |||
apiBackends: { | |||
onSuccess: function (formType, backendId) { | |||
onSuccess: function (formType, apiBackendId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need to change this to use before
or onSubmit
AutoForm hooks, so that we can validate the API Umbrella response.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem here is that I am afraid we might not have the apiBackend saved in mongoDB prior sending it to api umbrella. I will try this
@mauriciovieira here is one approach to show that form is submitting: AutoForm.hooks({
apiBackends: {
beginSubmit: function () {
// Disable form elements while submitting form
$('[data-schema-key],button').attr("disabled", "disabled");
},
endSubmit: function () {
// Enable form elements after form submission
$('[data-schema-key],button').removeAttr("disabled");
}
}
}); It simply disables all fields during the submission. |
@elnzv @brylie thank you guys for the tips. I already added some fixes to the code. |
I note that there are two objects in you examples:
What is the difference that causes the object to sometimes be named |
@brylie, it is not:
but
That means, all we get from
with the errors for each. So, the format
is never returned untill we fix the meteor-package error handling. |
ec903f5
to
b75ed3e
Compare
@elnzv please review again. @mauriciovieira and I did pair programming over the past two days to get things working. |
$('[data-schema-key], button').removeAttr("disabled"); | ||
}, | ||
before: { | ||
// Replace `formType` with the form `type` attribute to which this hook applies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cleanup comment
// }; | ||
|
||
if (apiUmbrellaWebResponse.http_status === 200) { | ||
//Return asynchronously |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Give a more meaningful comment here. E.g. 'submit the form on success'
Add error treatment to apiUmbrellaWeb[...].createApiBackend - closes #357
Feature/api backend error handling - redoes #527
@elnzv or @frenchbread please 🔍