Created
May 7, 2018 01:14
-
-
Save johncrisostomo/d13b4b9686b2cd4508a824b123878b53 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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