# All files / src/api user.ts

0% Statements 0/12
0% Branches 0/8
0% Functions 0/3
0% Lines 0/9

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16

     import { api } from './client';
    import type { UserStatistics, UserQuota, TranslationHistoryItem, PaginatedList } from './types';

    export const userApi = {
      getStatistics: () => api.get<UserStatistics>('/user/statistics'),
      getQuota: () => api.get<UserQuota>('/user/quota'),
      getTranslationHistory: (params?: { page?: number; pageSize?: number; type?: string }) => {
        const qs = new URLSearchParams();
        if (params?.page) qs.set('page', String(params.page));
        if (params?.pageSize) qs.set('pageSize', String(params.pageSize));
        if (params?.type) qs.set('type', params.type);
        const query = qs.toString();
        return api.get<PaginatedList<TranslationHistoryItem>>(`/user/translation-history${query ? `?${query}` : ''}`);
      },
    };