Skip to content

Commit

Permalink
add web
Browse files Browse the repository at this point in the history
  • Loading branch information
fifsky committed Mar 18, 2020
1 parent 21354a5 commit f804e9d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion web/src/util/request.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import {fetch} from 'dva'
import {Err} from './error'

const getApiUrl = (url) => {
return process.env.NODE_ENV === 'production' ? 'https://api.fifsky.com' + url : url
}

const codeMessage = {
200: '服务器成功返回请求的数据。',
201: '新建或修改数据成功。',
Expand Down Expand Up @@ -65,5 +69,5 @@ export const createApi = (url, body) => {
headers,
}

return request(url, param)
return request(getApiUrl(url), param)
}

0 comments on commit f804e9d

Please sign in to comment.