Skip to content

Commit

Permalink
Specify the backend address using environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
dracoooooo committed Jan 26, 2024
1 parent 5e8dcde commit 1980cf5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions frontend/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_BACKEND_URL=http://localhost:8000/
6 changes: 4 additions & 2 deletions frontend/src/components/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
import {reactive, ref} from "vue"
import {ElMessage, ElMessageBox} from "element-plus"
import type {UploadProps, UploadUserFile} from "element-plus"
import {run, get_current_log} from "@/api/api"
import {run} from "@/api/api"
import {InfoFilled} from "@element-plus/icons-vue"
const backendUrl = ref(import.meta.env.VITE_BACKEND_URL);
const testingOption = reactive({
db_url: 'jdbc:mysql://localhost:3306',
db_type: 'MYSQL',
Expand Down Expand Up @@ -314,7 +316,7 @@ const handleIndexChange = (index) => {
<el-upload
v-model:file-list="fileList"
class="upload-demo"
action="http://localhost:8000/upload/"
:action="backendUrl + 'upload'"
multiple
:on-preview="handlePreview"
:on-remove="handleRemove"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import axios from "axios";


const request = axios.create({
baseURL: 'http://localhost:8000/',
baseURL: import.meta.env.VITE_BACKEND_URL,
timeout: 300000,
})

Expand Down

0 comments on commit 1980cf5

Please sign in to comment.