MCPcopy
hub / github.com/ModelEngine-Group/nexent / getUserTokens

Function getUserTokens

frontend/services/tokenService.ts:21–34  ·  view source on GitHub ↗
(userId: string | number)

Source from the content-addressed store, hash-verified

19 * Fetch all API tokens for a given user
20 */
21export async function getUserTokens(userId: string | number): Promise<UserToken[]> {
22 try {
23 const response = await fetchWithErrorHandling(
24 `${API_ENDPOINTS.user.tokens}?user_id=${userId}`
25 );
26 const result: TokenListResponse = await response.json();
27 return result.data ?? [];
28 } catch (error) {
29 if (error instanceof ApiError) {
30 throw error;
31 }
32 throw new ApiError(500, "Failed to fetch user tokens");
33 }
34}
35
36/**
37 * Delete an API token by its ID

Callers 1

fetchAkSkInfoFunction · 0.90

Calls 2

fetchWithErrorHandlingFunction · 0.90
jsonMethod · 0.45

Tested by

no test coverage detected