File size: 244 Bytes
951bd56
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
const API_BASE = import.meta.env.VITE_API_BASE ?? ''

export async function apiGet (path) {
  const res = await fetch(API_BASE + path)
  if (!res.ok) {
    throw new Error(`API error ${res.status}: ${res.statusText}`)
  }
  return res.json()
}