Files
gofly-platform-services/zlt-web/react-web-next/src/services/token.ts
T

29 lines
877 B
TypeScript
Raw Normal View History

import { request } from 'umi';
export interface TokenItem {
tokenValue: string;
expiration?: string;
username?: string;
grantType?: string;
clientId?: string;
accountType?: string;
}
export const tokenApi = {
page: async (params: { current?: number; pageSize?: number; tenantId?: string; username?: string }) => {
const p2 = { tenantId: 'webApp', ...params };
const res = await request('/api-uaa/tokens', {
method: 'GET',
params: { page: p2.current, limit: p2.pageSize, ...p2 },
});
const data = (res as any).data;
const total = (res as any).count ?? data?.length ?? 0;
return { data, total } as { data: TokenItem[]; total: number };
},
delete: async (token: string) => {
const res = await request('/api-uaa/oauth/remove/token', { method: 'DELETE', params: { token } });
return (res as any).data || res;
},
};