forked from OtterMind/Chat2DB
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser.ts
More file actions
43 lines (34 loc) · 1.21 KB
/
Copy pathuser.ts
File metadata and controls
43 lines (34 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import createRequest from './base';
import { IPageParams, IPageResponse } from '@/typings';
import { IUserVO, IUser } from '@/typings/user';
/** 用户登录接口 */
const userLogin = createRequest<{ userName: string; password: string }, boolean>('/api/oauth/login_a', {
method: 'post',
});
/** 用户登出 */
const userLogout = createRequest<void, void>('/api/oauth/logout_a', {
method: 'post',
});
/** 获取用户信息 */
const getUser = createRequest<void, IUserVO | null>('/api/oauth/user_a', { method: 'get' });
/** 获取用户列表信息 */
const getUserList = createRequest<IPageParams, IPageResponse<IUser>>('/api/user/list', {
method: 'get',
});
/** 创建新用户 */
const createUser = createRequest<IUser, boolean>('/api/user/create', {
method: 'post',
});
/** 更新用户信息 */
const updateUser = createRequest<IUser, boolean>('/api/user/update', {
method: 'post',
});
/** 查询用户 */
const queryUserById = createRequest<{ id: number }>('/api/user/:id', {
method: 'get',
});
/** 删除用户 */
const deleteUser = createRequest<{ id: number }>('/api/user/:id', {
method: 'delete',
});
export { createUser, updateUser, queryUserById, deleteUser, getUserList, userLogin, userLogout, getUser };