Skip to content

Let's use AI to Earn!

feat: 环境变量中获取api地址

牛文政0a8c02c32fad
diff --git a/.gitignore b/.gitignore
index c641ceef..7988c644 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@ release
*.njsproj
*.sln
*.sw?
+.env
#lockfile
# package-lock.json
diff --git a/electron/main/index.ts b/electron/main/index.ts
index ca5bdf25..4b1f4fee 100644
--- a/electron/main/index.ts
+++ b/electron/main/index.ts
@@ -44,7 +44,7 @@ async function createWindow() {
splashWindow.create();
// 等待一会儿确保启动窗口显示
- await new Promise(resolve => setTimeout(resolve, 500));
+ await new Promise((resolve) => setTimeout(resolve, 500));
// 创建主窗口但先不显示
win = new BrowserWindow({
diff --git a/src/api/request.ts b/src/api/request.ts
index 99b5fd2d..ee423c9e 100644
--- a/src/api/request.ts
+++ b/src/api/request.ts
@@ -1,7 +1,7 @@
/*
* @Author: nevin
* @Date: 2025-01-17 20:21:04
- * @LastEditTime: 2025-01-17 20:29:46
+ * @LastEditTime: 2025-02-27 16:57:37
* @LastEditors: nevin
* @Description: 请求
*/
@@ -16,8 +16,7 @@ interface ProjectAxiosRequestConfig extends AxiosRequestConfig {
// 创建 axios 实例
const request = axios.create({
- // baseURL: 'https://ttgufwxxqyow.sealosbja.site/api', // 从环境变量获取基础URL
- baseURL: 'https://attapi.yikart.cn/api', // 从环境变量获取基础URL
+ baseURL: import.meta.env.VITE_APP_URL, // 从环境变量获取基础URL
timeout: 15000, // 请求超时时间
headers: {
'Content-Type': 'application/json',
diff --git a/vite.config.ts b/vite.config.ts
index 534d1eb0..80febfff 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,7 +1,7 @@
/*
* @Author: nevin
* @Date: 2025-01-17 19:25:29
- * @LastEditTime: 2025-02-27 16:35:55
+ * @LastEditTime: 2025-02-27 16:41:49
* @LastEditors: nevin
* @Description:
*/