Skip to content

Instantly share code, notes, and snippets.

@johncrisostomo
Created May 7, 2018 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johncrisostomo/d13b4b9686b2cd4508a824b123878b53 to your computer and use it in GitHub Desktop.
Save johncrisostomo/d13b4b9686b2cd4508a824b123878b53 to your computer and use it in GitHub Desktop.
create({Meteor, LocalState, FlowRouter}, title, content) {
if (!title || !content) {
return LocalState.set('SAVING_ERROR', 'Title & Content are required!');
}
LocalState.set('SAVING_ERROR', null);
const id = Meteor.uuid();
Meteor.call('posts.create', id, title, content, (err) => {
if (err) {
return LocalState.set('SAVING_ERROR', err.message);
}
});
FlowRouter.go(`/post/${id}`);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment