Can I bind the request id using axios?

The

page is a tree, that you can click to modify. If you want to support a node to modify, loading, can also modify other nodes in parallel at this time. If the previous node request fails, an error is returned and the loading of the corresponding node is stopped.

now it is found that the node in catch that failed to get the corresponding request id, does not know whether axios supports setting a request id, or how to pass id into catch

if (this.moduleNodeQuery.currentId > 0) {
        this.requestEditing[data.id] = true
        editModule(this.moduleNodeQuery).then(response => {
          this.requestEditing[data.id] = false
          const id = response.data.id
          this.tmpNodeData[id].label = response.data.moduleName
          this.tmpNodeData[id].owner = response.data.owner
          this.moduleNodeQuery.currentId = -1
          this.$message({
            message: "edit success",
            type: "success"
          })
          if (callback) {
            callback()
          }
        }).catch(() => {
          this.$message({
            message: "edit error",
            type: "error"
          })
          
          Id
          this.requestEditing[Id] = false
        })
Jan.18,2022

catch also has parameters to choose

catch(err => {
    console.log(err.id)
})
Menu