feat: use simpler nitro instead of nestjs to implement mock service
This commit is contained in:
17
apps/web-antd/src/apis/core/auth.ts
Normal file
17
apps/web-antd/src/apis/core/auth.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { UserApi } from '../types';
|
||||
|
||||
import { requestClient } from '#/forward';
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
export async function login(data: UserApi.LoginParams) {
|
||||
return requestClient.post<UserApi.LoginResult>('/auth/login', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户权限码
|
||||
*/
|
||||
export async function getAccessCodes() {
|
||||
return requestClient.get<string[]>('/auth/codes');
|
||||
}
|
@@ -1,3 +1,3 @@
|
||||
export * from './auth';
|
||||
export * from './menu';
|
||||
export * from './mock';
|
||||
export * from './user';
|
@@ -5,8 +5,6 @@ import { requestClient } from '#/forward';
|
||||
/**
|
||||
* 获取用户所有菜单
|
||||
*/
|
||||
async function getAllMenus() {
|
||||
return requestClient.get<RouteRecordStringComponent[]>('/menu/getAll');
|
||||
export async function getAllMenus() {
|
||||
return requestClient.get<RouteRecordStringComponent[]>('/menu/all');
|
||||
}
|
||||
|
||||
export { getAllMenus };
|
10
apps/web-antd/src/apis/core/user.ts
Normal file
10
apps/web-antd/src/apis/core/user.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import type { UserInfo } from '@vben/types';
|
||||
|
||||
import { requestClient } from '#/forward';
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
export async function getUserInfo() {
|
||||
return requestClient.get<UserInfo>('/user/info');
|
||||
}
|
1
apps/web-antd/src/apis/demos/index.ts
Normal file
1
apps/web-antd/src/apis/demos/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './status';
|
@@ -4,7 +4,7 @@ import { requestClient } from '#/forward';
|
||||
* 模拟任意状态码
|
||||
*/
|
||||
async function getMockStatus(status: string) {
|
||||
return requestClient.get('/mock/status', { params: { status } });
|
||||
return requestClient.get('/status', { params: { status } });
|
||||
}
|
||||
|
||||
export { getMockStatus };
|
@@ -1,2 +1,3 @@
|
||||
export * from './modules';
|
||||
export * from './core';
|
||||
export * from './demos';
|
||||
export type * from './types';
|
||||
|
@@ -1,28 +0,0 @@
|
||||
import type { UserInfo } from '@vben/types';
|
||||
|
||||
import type { UserApi } from '../types';
|
||||
|
||||
import { requestClient } from '#/forward';
|
||||
|
||||
/**
|
||||
* 登录
|
||||
*/
|
||||
async function userLogin(data: UserApi.LoginParams) {
|
||||
return requestClient.post<UserApi.LoginResult>('/auth/login', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
async function getUserInfo() {
|
||||
return requestClient.get<UserInfo>('/auth/getUserInfo');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户权限码
|
||||
*/
|
||||
async function getAccessCodes() {
|
||||
return requestClient.get<string[]>('/auth/getAccessCodes');
|
||||
}
|
||||
|
||||
export { getAccessCodes, getUserInfo, userLogin };
|
Reference in New Issue
Block a user