Problem scenario

Multi-step invocation scenarios occur when developing subscription functionality in applets:

  • Wechat subscription API
  • Querying whether to Log in
  • To obtain the openId
  • Send a subscription

In the code

function subscribe(){
    Taro.requestSubscribeMessage()
        .then(isLogin)
        .then(getOpenid)
        .then(postSubscript)
        .catch((err) = >{
            mes(err)
        })
}
Copy the code