feat: 重构前端界面并优化API集成
- 添加vite环境类型定义文件 - 优化考勤记录视图 - 修复后端时间戳处理问题 - 重构管理仪表盘响应式布局 - 改进工人历史视图卡片式布局 - 优化人员管理组件表格响应式 - 增强二维码管理组件移动端适配 - 重构考勤报表组件添加全选功能
This commit is contained in:
+20
@@ -0,0 +1,20 @@
|
||||
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL
|
||||
|
||||
export async function apiFetch(endpoint, options = {}) {
|
||||
const defaultHeaders = {
|
||||
'ngrok-skip-browser-warning': 'true',
|
||||
'Content-Type': 'application/json',
|
||||
...options.headers,
|
||||
}
|
||||
|
||||
const response = await fetch(`${API_BASE_URL}${endpoint}`, {
|
||||
...options,
|
||||
headers: defaultHeaders,
|
||||
})
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`API call failed with status: ${response.status}`)
|
||||
}
|
||||
|
||||
return response.json()
|
||||
}
|
||||
Reference in New Issue
Block a user