When encapsulating a http request with axios, how to determine the corresponding operation after the custom status value is successful?

previously you could handle this in ajax

request(param){
    $.ajax{
        type: param.type,
        url: param.url,
        success(res){
            if(res.status === 0){
                typeof param.success === "function" && param.success(res.data)
            }else if(res.status === 1){
                login()        
            }else if(res.status === 2){
                typeof param.success === "function" && param.success(res.data)
            }
        },
        error(err){
            typeof param.error === "function" && param.error(res.err)
        }
    }
} 
   

in a case like the one above, for example, a status of 0 indicates success, and then the processing is performed after success. How do you deal with this in axios?

Apr.07,2021

import axios from 'axios'

//
axios.interceptors.request.use(function(config){
    ...
    return config
})

//
axios.interceptors.response.use(function(config){
    ...    
    return config
})
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3880a-2c123.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3880a-2c123.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?