admin-vben5/apps/web-ele/src/api/core/auth.ts
Li Kui 4074a88c13
feat: element-plus app (#32)
* chore: init project

* chore: install element-plus

* chore: locale config

* fix: eslint error

* chore: merge from main

* fix: lint

* chore: finish todo

* chore: update comments

* chore: update

* fix: lint error

* chore: add unplugin-element-plus

* chore: add useElementPlusDesignTokens

* chore: configure some color
2024-07-31 21:22:43 +08:00

34 lines
667 B
TypeScript

import { requestClient } from '#/api/request';
export namespace AuthApi {
/** 登录接口参数 */
export interface LoginParams {
password: string;
username: string;
}
/** 登录接口返回值 */
export interface LoginResult {
accessToken: string;
desc: string;
realName: string;
refreshToken: string;
userId: string;
username: string;
}
}
/**
* 登录
*/
export async function login(data: AuthApi.LoginParams) {
return requestClient.post<AuthApi.LoginResult>('/auth/login', data);
}
/**
* 获取用户权限码
*/
export async function getAccessCodes() {
return requestClient.get<string[]>('/auth/codes');
}