chore: update types

This commit is contained in:
vben
2024-06-02 20:47:50 +08:00
parent b200ae9997
commit ce0c3834ed
31 changed files with 485 additions and 124 deletions

View File

@@ -0,0 +1,2 @@
export * from './modules';
export type * from './types';

View File

@@ -0,0 +1 @@
export * from './user';

View File

@@ -0,0 +1,22 @@
import type { UserApiType } from '@/apis/types';
import type { UserInfo } from '@vben/types';
import { request } from '@/apis/request';
/**
* 登录
*/
async function userLogin(data: UserApiType.LoginParams) {
return request<UserApiType.LoginResult>('/login', { data, method: 'post' });
}
/**
* 获取用户信息
*/
async function getUserInfo() {
return request<UserInfo>('/getUserInfo', { method: 'get' });
}
export { getUserInfo, userLogin };
export * from './user';

View File

@@ -0,0 +1 @@
export type * from './user';

View File

@@ -1,4 +1,4 @@
namespace UserApi {
namespace UserApiType {
/** 登录接口参数 */
export interface LoginParams {
password: string;
@@ -15,4 +15,4 @@ namespace UserApi {
}
}
export type { UserApi };
export type { UserApiType };

View File

@@ -1 +0,0 @@
export * from './modules/user';

View File

@@ -1,23 +0,0 @@
import type { UserInfo } from '@vben/types';
import { request } from '@/services/request';
import type { UserApi } from './typing';
/**
* 登录
*/
async function userLogin(data: UserApi.LoginParams) {
return request<UserApi.LoginResult>('/login', { data, method: 'post' });
}
/**
* 获取用户信息
*/
async function getUserInfo() {
return request<UserInfo>('/getUserInfo', { method: 'get' });
}
export { getUserInfo, userLogin };
export type { UserApi } from './typing';

View File

@@ -3,7 +3,7 @@ import type { LoginAndRegisterParams } from '@vben/common-ui';
import { useAccessStore } from '@vben-core/stores';
import { getUserInfo, userLogin } from '@/services';
import { getUserInfo, userLogin } from '@/apis';
import { AuthenticationLogin } from '@vben/common-ui';
import { $t } from '@vben/locales';
import { useRequest } from '@vben/request';