react axios接口Url封装

方法:

let ipUrl = "https://www.***.com/";

let servicePath = {
    Login: ipUrl + "login", //  登录接口
    Logout: ipUrl + "logout", //  登出
    ChangePassword: ipUrl + "admin_user/change_pwd", //找回密码
};
export default servicePath;

引用:

import servicePath from "../../components/apiUrl"; //接口url封装

调用:

axios({
    method: "post",
        url: servicePath.Login,//接口
        data: { ... },
    })

你可能感兴趣的:(react)