web/src/api/v1.ts

16 lines
284 B
TypeScript

const API_PREFIX = '/api/v1'
export class RbApi {
async get_json (path) {
const url = `${API_PREFIX}${path}`
const res = await fetch(url)
return await res.json()
}
async sections () {
const res = await this.get_json('/sections')
return res.sections
}
}