This commit is contained in:
2026-06-16 10:45:14 +08:00
parent 5b53e33e27
commit 2dd1ef77cb
4 changed files with 16 additions and 2 deletions

View File

@@ -0,0 +1,12 @@
import { requestClient } from '@/api/request'
/** 账户信息 */
interface IAccountInfo {
id: number
username: string
}
/** 获取账户信息 */
function getAccountInfo() {
return requestClient.get<IAccountInfo>('/account')
}

View File

@@ -1,5 +1,5 @@
import { createDiscreteApi } from 'naive-ui'
import { eventBus, AppEvents } from '@/utils/eventBus'
import { eventBus, AppEvents } from '@/utils'
import type { RequestErrorEvent } from './types'
/** 离散式 API可在组件外使用 */

View File

@@ -1,6 +1,6 @@
import axios, { type AxiosInstance, type AxiosRequestConfig, type CreateAxiosDefaults } from 'axios'
import { useAccountStore } from '@/stores'
import { eventBus, AppEvents } from '@/utils/eventBus'
import { eventBus, AppEvents } from '@/utils'
import type { ApiResponse, InternalRequestConfig, RequestErrorEvent } from './types'
/**

2
src/utils/index.ts Normal file
View File

@@ -0,0 +1,2 @@
export * from './eventBus.ts'
export * from './useDebouncedRef.ts'