feat(登录): 添加设备选择功能并实现登录接口集成

在登录弹窗中增加设备选择下拉框,并修改postAction以支持baseURL参数
实现用户登录接口调用,根据选择的设备进行登录请求
This commit is contained in:
houakang
2026-04-12 12:51:40 +08:00
parent d6491ecba4
commit 8b145d79d3
4 changed files with 40 additions and 10 deletions

View File

@@ -4,6 +4,9 @@ import url, { getBaseUrl } from './url.js';
// 健康检查
export const getHealthAction = () => getAction(url.health);
// 用户登录
export const loginAction = (data, sparkBaseUrl) => postAction(url.user.login, data, {}, sparkBaseUrl);
// 会话
export const createSessionAction = (data) => postAction(url.session.create, data);
export const getSessionAction = (id) => getAction(url.session.detail(id));

View File

@@ -1,17 +1,17 @@
import request from './index.js'
import request from './index.js';
export function getAction(url, params) {
return request({ url, method: 'GET', params })
return request({ url, method: 'GET', params });
}
export function postAction(url, data, headers = {}) {
return request({ url, method: 'POST', data, headers })
export function postAction(url, data, headers = {}, baseURL) {
return request({ url, method: 'POST', data, headers, ...(baseURL ? { baseURL } : {}) });
}
export function putAction(url, data) {
return request({ url, method: 'PUT', data })
return request({ url, method: 'PUT', data });
}
export function deleteAction(url, params) {
return request({ url, method: 'DELETE', params })
return request({ url, method: 'DELETE', params });
}

View File

@@ -22,6 +22,11 @@ const url = {
list: (sessionId) => `/session/${sessionId}/message`,
},
// 用户
user: {
login: '/v1/user/login',
},
// SSE 事件流
event: '/event',
};