2016-04-15 88 views
0

流星1.3千年發展目標:經過驗證法流星無法訪問回調響應PARAM

進口/ API /用戶/ methods.js

export const register = new ValidatedMethod({ 

    name: 'register', 

    validate: new SimpleSchema({ 
     mobile: { type: String }, 
    }).validator(), 

    run({ mobile }) { 
     let response = { 
      success: false, 
      message: 'Error' 
     }; 

     if(true) { 
      response.success = true; 
      response.message: 'Done'; 
     } 

     return response; 
    } 
}); 

進口/ UI /網頁/ home.js

UserMethods.register.call({mobile}, (error, response) => { 
    console.log(error); // okay 
    console.log(response); // unable to access response 

    if(response.success) { 
     template.$('#enter-mobile').hide(); 
     template.$('#enter-otp').fadeIn(); 
    } 
}); 

我無法在UserMethods.register.call({mobile}, (error, response)

訪問response如何解決這一問題?

回答

0

因此,對於任何面臨同樣問題的人,問題是我沒有加載服務器上的imports/api/user/methods.js

/app/imports/startup/server/api.js import '../../api/user/methods';

回調響應基本上來自服務器。