From f804e9dabc2280024ef959c7a5000849cbc222bf Mon Sep 17 00:00:00 2001 From: fifsky Date: Wed, 18 Mar 2020 22:18:12 +0800 Subject: [PATCH] add web --- web/src/util/request.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/web/src/util/request.js b/web/src/util/request.js index e26073c..1c833a1 100644 --- a/web/src/util/request.js +++ b/web/src/util/request.js @@ -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: '新建或修改数据成功。', @@ -65,5 +69,5 @@ export const createApi = (url, body) => { headers, } - return request(url, param) + return request(getApiUrl(url), param) }