Commit e89a522f by zhanghaozhe

proxy

parent 0e9cf3bb
import React, { Component } from "react" import React, { PureComponent } from "react"
import { VList } from '../../../common' import { VList } from '../../../common'
import './my-courses.scss' import './my-courses.scss'
import { api } from '@/utils' import { api } from '@/utils'
...@@ -50,7 +50,7 @@ function AddCourse(props) { ...@@ -50,7 +50,7 @@ function AddCourse(props) {
) )
} }
export default class MyCourses extends Component { export default class MyCourses extends PureComponent {
handleClick = () => { handleClick = () => {
console.log(1); console.log(1);
} }
......
...@@ -5,7 +5,7 @@ import { Provider } from 'react-redux' ...@@ -5,7 +5,7 @@ import { Provider } from 'react-redux'
import thunk from 'redux-thunk' import thunk from 'redux-thunk'
import { logger } from 'redux-logger' import { logger } from 'redux-logger'
// import Router from './router'; // import Router from './router';
import store from './store' import rootReducers from './store'
import App from './App'; import App from './App';
// 默认样式 // 默认样式
...@@ -15,12 +15,12 @@ import './assets/css/index.scss'; ...@@ -15,12 +15,12 @@ import './assets/css/index.scss';
import './assets/font/iconfont.css'; import './assets/font/iconfont.css';
var tooltore = createStore(store, compose( var store = createStore(rootReducers, compose(
applyMiddleware(thunk,logger) applyMiddleware(thunk,logger)
)) ))
ReactDOM.render( ReactDOM.render(
<Provider store={tooltore}> <Provider store={store}>
<App /> <App />
</Provider>, </Provider>,
document.getElementById('root')); document.getElementById('root'));
\ No newline at end of file
import { BASE_URL as target } from './utils/api' // import { BASE_URL as target } from './utils/api'
const proxy = require('http-proxy-middleware') const proxy = require('http-proxy-middleware')
const target = 'http://fast-test.julyedu.com'
module.exports = function (app) { module.exports = function (app) {
app.use(proxy( app.use(proxy(
'/api', '/api',
......
import axios from "axios"; import axios from "axios";
import qs from 'qs' import qs from 'qs'
export const BASE_URL = process.env.NODE_ENV === 'development' ? 'http://fast-test.julyedu.com/api': 'https://api.julyedu.com' export const BASE_URL = process.env.NODE_ENV === 'development' ? '/api': 'https://api.julyedu.com'
const instance = axios.create({ const instance = axios.create({
baseURL: BASE_URL, baseURL: BASE_URL,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment