浏览代码

切换后台接口

daxia 1 年之前
父节点
当前提交
892c0a1b15

+ 1 - 1
20_React.js_VIP22/day-8下/code/react-project-demo/src/api/user.js

@@ -8,5 +8,5 @@ import axios from 'axios';
  * @return  {[type]}        [return Promise]
  */
 export function login(user) {
-  return axios.post('/api/login', user);
+  return axios.post('/api/v1/login', user);
 }

+ 1 - 1
20_React.js_VIP22/day-8下/code/react-project-demo/src/setupProxy.js

@@ -2,7 +2,7 @@ const { createProxyMiddleware } = require('http-proxy-middleware');
 
 module.exports = function (app) {
   app.use(
-    '/api',
+    '/api/v1',
     createProxyMiddleware({
       target: 'http://localhost:4000',
       changeOrigin: true,