import { Client } from '../types' import axios from 'axios' import settings from '../settings' if (settings.env === 'jank') { const host = 'http://192.168.1.107:5000' axios.defaults.baseURL = host } export const createClient = async (body: Omit) => { const res = await axios.post<{ client_id: string }>(`/api/clients`, body) return res.data.client_id } export const getClient = async (id: string): Promise => { const res = await axios.get(`/api/clients/${id}`) return res.data } export const startSession = async (clientId: string) => { const res = await axios.post(`/api/clients/${clientId}/session`) return res.data // session data } export const getSession = async (clientId: string) => { const res = await axios.get<{ photos: string[] }>( `/api/clients/${clientId}/session`, ) return res.data // session data } export const killSession = async (clientId: string) => { await axios.delete(`/api/clients/${clientId}/session`) } export const restartSession = async (clientId: string) => { await killSession(clientId) await startSession(clientId) } // TOOD: Get status // Someday export const getClients = async (): Promise => { const res = await axios.get(`/api/clients`) return res.data } export const cleanup = () => { // send }