0
我新手環回,我寫了一個功能註冊和 上beforeRemote執行。在這裏我可以訪問環回上下文。但用戶創建後,我執行另一個功能,使用afterRemote發送驗證鏈接,此處loopback上下文返回空值。迴環背景下返回null在afterRemote方法
function signup(){
const lbCtx = LoopBackContext.getCurrentContext;
const details = lbctx().get('details');
//here it's working
}
function sendVerificationEmail(){
const lbCtx = LoopBackContext.getCurrentContext;
const details = lbctx().get('details');
//here not working
}
Users.beforeRemote('create', (ctx) => signup(ctx));
Users.afterRemote('create', (ctx) => sendVerificationEmail(ctx));
任何人都可以幫助我實現這一點。