What are the methods for Mini Program success to assign values to external variables?

I mainly want to store the returned information in data when post returns, and find that it is not possible for setData to be written in wx.request. Finally, I can only use wx.setStorageSync storage. I just contacted Mini Program and soon wanted to ask the boss if there is any other way to save the return value.

var that=this;
Page({
  data: {
    mediaurl:"1"
  },
onLaunch: function() {
    var that = this;
    wx.request({
      url: "http://www.test.php/login",
      data: {
        UserCode: "wechart",
      },
      method: "post",
      success: function (res) {
        that.setData({
          mediaurl: ""
        })
      }
    })
    }
})

Hello, is "setData not allowed" an error or something wrong? I didn't find anything wrong with setData when I developed it. Generally, you can also use the wepy framework, which encapsulates this method and can directly:

this.title = "this is title";
this.$apply();
Menu