coolair
V2EX  ›  问与答

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

  •  
  •   coolair · Aug 1, 2019 · 1778 views
    This topic created in 2502 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   ·   818 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 21:31 · PVG 05:31 · LAX 14:31 · JFK 17:31
    ♥ Do have faith in what you're doing.