mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-09-18 20:57:08 +08:00
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import type * as T from './type'
|
|
import http from '@/utils/http'
|
|
|
|
export type * from './type'
|
|
|
|
const BASE_URL = '/auth'
|
|
|
|
/** @desc 账号登录 */
|
|
export function accountLogin(req: T.AccountLoginReq) {
|
|
return http.post<T.LoginResp>(`${BASE_URL}/login`, req)
|
|
}
|
|
|
|
/** @desc 手机号登录 */
|
|
export function phoneLogin(req: T.PhoneLoginReq) {
|
|
return http.post<T.LoginResp>(`${BASE_URL}/login`, req)
|
|
}
|
|
|
|
/** @desc 邮箱登录 */
|
|
export function emailLogin(req: T.EmailLoginReq) {
|
|
return http.post<T.LoginResp>(`${BASE_URL}/login`, req)
|
|
}
|
|
|
|
/** @desc 三方账号登录 */
|
|
export function socialLogin(req: any) {
|
|
return http.post<T.LoginResp>(`${BASE_URL}/login`, req)
|
|
}
|
|
|
|
/** @desc 三方账号登录授权 */
|
|
export function socialAuth(source: string) {
|
|
return http.get<T.SocialAuthAuthorizeResp>(`/oauth/${source}`)
|
|
}
|
|
|
|
/** @desc 退出登录 */
|
|
export function logout() {
|
|
return http.post(`${BASE_URL}/logout`)
|
|
}
|
|
|
|
/** @desc 获取用户信息 */
|
|
export const getUserInfo = () => {
|
|
return http.get<T.UserInfo>(`${BASE_URL}/user/info`)
|
|
}
|
|
|
|
/** @desc 获取路由信息 */
|
|
export const getUserRoute = () => {
|
|
return http.get<T.RouteItem[]>(`${BASE_URL}/user/route`)
|
|
}
|