import { makeRequest } from "@frontend/kitui"; import type { LoginRequest, LoginResponse } from "@frontend/kitui"; import { parseAxiosError } from "../utils/parse-error"; const apiUrl = process.env.REACT_APP_DOMAIN + "/statistic"; export type DevicesResponse = { device: Record; os: Record; browser: Record; }; export const getDevicesList = async ( quizId: string, ): Promise<[any | null, string?]> => { try { const devicesResponse = await makeRequest({ method: "POST", url: `${apiUrl}/devices?quizID=${quizId}`, useToken: false, withCredentials: true, }); return [devicesResponse]; } catch (nativeError) { const [error] = parseAxiosError(nativeError); return [null, `Не получить статистику о девайсах. ${error}`]; } };