diff --git a/frontend/.env.development b/frontend/.env.development index 53240f56..dade16fb 100644 --- a/frontend/.env.development +++ b/frontend/.env.development @@ -1 +1,2 @@ -API_BASE_URL=http://localhost:5000/api +NODE_ENV='development' +VUE_APP_BASE_URL=http://localhost:8000/api diff --git a/frontend/.env.production b/frontend/.env.production index dc42502a..a8b89254 100644 --- a/frontend/.env.production +++ b/frontend/.env.production @@ -1 +1,2 @@ -API_BASE_URL=http://139.129.230.98:8000/api +NODE_ENV='production' +VUE_APP_BASE_URL=http://crawlab.cn:8000/api diff --git a/frontend/package.json b/frontend/package.json index 1e005431..5b533470 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,12 +1,12 @@ { "name": "crawlab", - "version": "0.2.0", + "version": "0.2.1", "private": true, "scripts": { "serve": "cross-env NODE_ENV=development vue-cli-service serve --ip=0.0.0.0", - "serve-prod": "cross-env NODE_ENV=production vue-cli-service serve --mode=production --ip=0.0.0.0", + "serve:prod": "cross-env NODE_ENV=production vue-cli-service serve --mode=production --ip=0.0.0.0", "config": "vue ui", - "build": "vue-cli-service build", + "build:prod": "vue-cli-service build --mode production", "lint": "vue-cli-service lint", "test:unit": "vue-cli-service test:unit" }, diff --git a/frontend/src/api/request.js b/frontend/src/api/request.js index 53603af8..4aaa0c04 100644 --- a/frontend/src/api/request.js +++ b/frontend/src/api/request.js @@ -1,15 +1,12 @@ import axios from 'axios' -let baseUrl = 'http://localhost:8000/api' -if (process.env.NODE_ENV === 'production') { - baseUrl = 'http://139.129.230.98:8000/api' -} +let baseUrl = process.env.VUE_APP_API_BASE_URL ? process.env.VUE_APP_API_BASE_URL : 'http://localhost:8000/api' // console.log(process.env) // const baseUrl = process.env.API_BASE_URL || 'http://localhost:8000/api' const request = (method, path, params, data) => { return new Promise((resolve, reject) => { - const url = `${baseUrl}${path}` + const url = baseUrl + path axios({ method, url, diff --git a/frontend/src/components/Config/ConfigList.vue b/frontend/src/components/Config/ConfigList.vue index 76f42e34..b5dcda0b 100644 --- a/frontend/src/components/Config/ConfigList.vue +++ b/frontend/src/components/Config/ConfigList.vue @@ -37,6 +37,9 @@ + + + @@ -70,9 +73,6 @@ :placeholder="$t('Pagination Selector')"> - - -