简体   繁体   中英

MeteorJS - Error invoking Method 'updatePostData': Internal server error [500]

Hi guys I am working on MeteorJS right now and I can not seem to update the collection. I got the error:

Error invoking Method 'updatePostData': Internal server error [500]

here is my client side code:

Template.my_posts.events({
'submit #pupdate': function(event) {
            event.preventDefault();
            var currentUserId = Meteor.userId();
            var pauthor = event.target.updateauthor.value;
            var ptitle = event.target.updatetitle.value;
            var pcontent = event.target.updatecontent.value;
            var pdate_pub = new Date()

            console.log(pauthor);
            console.log(ptitle);
            console.log(pcontent);
            console.log(currentUserId);
            console.log(pdate_pub);
            Meteor.call('updatePostData',ptitle,pcontent,pdate_pub,currentUserId,pauthor);
        }
});

Here is my server side code:

Meteor.methods({
'updatePostData': function(ptitle,pcontent,pdate_pub,currentUserId,pauthor) {
            var selPostId = Session.get('selPostId');
            webPost.update(selPostId, {$set: {
                title: ptitle,
                content: pcontent,
                p_author: pauthor,
                date_pub: pdate_pub,
                author_id: currentUserId
            }});
        }
});

Please help, thank you

I FINALLY FIGURED IT OUT!! HAHAHA . . declared the session in the client side then pass it to the meteor.call and then call the variable in the server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM