File size: 484 Bytes
b5af7d6
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
export async function requestAlignment(data) {
  const response = await fetch('/api/register', {method: 'POST', body: data});
  const body = await response.json().catch(() => null);
  if (!response.ok) {
    throw new Error(typeof body?.detail === 'string' ? body.detail : `The request could not be completed (${response.status}). Please retry.`);
  }
  if (!body?.images || !body?.metrics) throw new Error('The server returned an incomplete review. Please retry.');
  return body;
}