File size: 298 Bytes
1ee4c18
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
export async function roastCode(code, language) {
  const res = await fetch('/api/roast', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ code, language }),
  });
  if (!res.ok) throw new Error((await res.json()).error);
  return res.json();
}