V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
coolair
V2EX  ›  问与答

请教一下刷新 token 然后再次发起请求应该如何写?

  •  
  •   coolair · Aug 1, 2019 · 1736 views
    This topic created in 2467 days ago, the information mentioned may be changed or developed.
    wx.request({
      url: 'http://127.0.0.1/api/1_0/test',
      method: 'GET',
      header: {
        Authorization: accessToken
      },
      success(res) {
        if (res.statusCode == 401 && res.data.msg == 'Token has expired') {
            refreshToken();
            // 怎么再次发送请求?
        }
      }
    });
    
    2 replies    2019-08-01 20:56:20 +08:00
    zhaishunqi
        1
    zhaishunqi  
       Aug 1, 2019
    我有一个大胆的想法。。。
    ysc3839
        2
    ysc3839  
       Aug 1, 2019 via Android
    用 do while。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2655 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 03:43 · PVG 11:43 · LAX 20:43 · JFK 23:43
    ♥ Do have faith in what you're doing.