obs-portal/src/api.js
Paul Bienkowski c1186e4074 First bit of work:
* login
* login state management
* API baseline code
* load tracks
* show tracks
* basic routing
* basic styling
* add react-semantic-ui
* add typescript
2021-02-10 22:28:46 +01:00

22 lines
402 B
JavaScript

class API {
setAuthorizationHeader(authorization) {
this.authorization = authorization
}
async fetch(url, options = {}) {
const response = await window.fetch('/api' + url, {
...options,
headers: {
...(options.headers || {}),
Authorization: this.authorization,
},
})
return await response.json()
}
}
const api = new API()
export default api