Centralize typed resource functions under common/apis and return complete JSON envelopes while preserving raw responses, bearer session isolation, and single-owner errors. Keep settings state and queues inside the setup store. Use Element Plus forms and dialogs for login, settings, imports, moves, and images; preserve editor interactions and themes. Update callers, tests, generated declarations, and request import constraints together.
31 lines
719 B
TypeScript
31 lines
719 B
TypeScript
import type * as Tokens from './type'
|
|
import { request } from '@/http/axios'
|
|
|
|
/** 读取 API 令牌列表。 */
|
|
export function getTokensApi() {
|
|
return request<Tokens.TokensResponseData>({
|
|
url: 'tokens',
|
|
method: 'get',
|
|
errorOwner: 'caller',
|
|
})
|
|
}
|
|
|
|
/** 创建 API 令牌。 */
|
|
export function createTokenApi(data: Tokens.CreateTokenRequestData) {
|
|
return request<Tokens.CreateTokenResponseData>({
|
|
url: 'tokens',
|
|
method: 'post',
|
|
data,
|
|
errorOwner: 'caller',
|
|
})
|
|
}
|
|
|
|
/** 撤销 API 令牌。 */
|
|
export function deleteTokenApi(id: string) {
|
|
return request<Tokens.DeleteTokenResponseData>({
|
|
url: `tokens/${encodeURIComponent(id)}`,
|
|
method: 'delete',
|
|
errorOwner: 'caller',
|
|
})
|
|
}
|