Should be probably done "before" DB insert in autoform.js:
AutoForm.hooks({
"addApiForm": {
before: {
insert (api) {
// Get current user ID
const userId = Meteor.userId();
// Add current user as API manager
api.managerIds = [userId];
// Submit the form
return api;
}
},
onSuccess (formType, apiId) {
// Redirect to newly added API
Router.go("viewApi", { _id: apiId });
}
}
});
Catalogue shows "Added a few seconds ago" for all APIs that don't have that generated.