feat: add new interfaces, services, and utilities for API integration

refactor: reorganize type definitions and improve type safety

build: add lodash and @types/lodash as dependencies

chore: update tsconfig and vite config for path aliases

style: improve code organization and add documentation comments

fix: correct type usage in LanguageSwitcher component

perf: implement snackbar provider for global notifications

test: add new test interfaces and utility functions

ci: update pnpm-lock.yaml with new dependencies
This commit is contained in:
2025-10-10 15:09:04 +08:00
parent 8cf7a4e5d5
commit a1282de74f
45 changed files with 5088 additions and 274 deletions

View File

@@ -0,0 +1,74 @@
import api from './api';
import request, { post } from '@/utils/request';
// 用户相关API服务
const userService = {
// 用户登录
login: (data: { email: string; password: string }) => {
return post(api.login, data);
},
// 用户登出
logout: () => {
return request.get(api.logout);
},
// 用户注册
register: (data: { email: string; password: string; username?: string }) => {
return post(api.register, data);
},
// 获取用户信息
getUserInfo: () => {
return request.get(api.user_info);
},
// 更新用户设置
updateSetting: (data: any) => {
return post(api.setting, data);
},
// 获取租户信息
getTenantInfo: () => {
return request.get(api.tenant_info);
},
// 设置租户信息
setTenantInfo: (data: any) => {
return post(api.set_tenant_info, data);
},
// 获取登录渠道
getLoginChannels: () => {
return request.get(api.login_channels);
},
// 通过渠道登录
loginWithChannel: (channel: string) => {
window.location.href = api.login_channel(channel);
},
// 租户用户管理
listTenantUser: (tenantId: string) => {
return request.get(api.listTenantUser(tenantId));
},
addTenantUser: (tenantId: string, email: string) => {
return post(api.addTenantUser(tenantId), { email });
},
deleteTenantUser: ({ tenantId, userId }: { tenantId: string; userId: string }) => {
return request.delete(api.deleteTenantUser(tenantId, userId));
},
// 租户管理
listTenant: () => {
return request.get(api.listTenant);
},
agreeTenant: (tenantId: string) => {
return request.put(api.agreeTenant(tenantId));
},
};
export default userService;