私はReactjsを持つ最初のアプリケーションを構築しており、Flux Modelを実装するためにAltライブラリも使用しています。 私は動詞を持っていますが、修正しようとしましたが、うまくいきませんでした。ここでアクションReactJsを使用Alt
import alt from '../alt';
class AddUserActions {
constructor() {
this.generateActions(
'addUserSuccess',
'addUserFail'
);}
addUser(payload)
{
$.ajax({
type:'POST',
url:'/api/user',
data:{username:payload.username,
password:payload.password,
fbId:payload.fbId
}
})
.done((data) => {
this.actions.addUserSuccess(data.message);
})
.fail((jqXhr) =>{
this.actions.addUserFail(jqXhr.responseJSON.message);
});
}
}
export default alt.createActions(AddUserActions);
は、data.messageとのLocalServer応答が "成功" で、ステータスPloblemがthis.actions.addUserSuccess(data.message);
で発生し200: はここに私のコードです。 エラー:Uncaught TypeError: Cannot read property 'addUserSuccess' of undefined
私はその理由を知らなかった。私を助けてください!