You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
981 B
35 lines
981 B
import settings from '../settings' |
|
import { Client } from '../types' |
|
import axios from 'axios' |
|
|
|
const { apiUrl } = settings |
|
|
|
export const createClient = async (body: Client) => { |
|
await axios.post(`${apiUrl}/clients`, body) |
|
} |
|
|
|
export const getClients = async (): Promise<Client[]> => { |
|
const res = await axios.post<Client[]>(`${apiUrl}/clients`) |
|
return res.data as Client[] |
|
} |
|
|
|
export const beginCapture = async (clientId: string) => { |
|
const res = await axios.post(`${apiUrl}/clients/${clientId}/session`) |
|
return res.data as string // capture id |
|
} |
|
|
|
export const getCapture = async ( |
|
clientId: string, |
|
): Promise<null | string[]> => { |
|
const res = await axios.get(`${apiUrl}/clients/${clientId}/session`) |
|
return res.data as null | string[] |
|
} |
|
|
|
export const retryCapture = async (clientId: string) => { |
|
await axios.delete(`${apiUrl}/clients/${clientId}/session`) |
|
await axios.post(`${apiUrl}/clients/${clientId}/session`) |
|
} |
|
|
|
export const cleanup = () => { |
|
// send |
|
}
|
|
|