diff options
Diffstat (limited to 'hi-ui/src/apiServer.js')
| -rw-r--r-- | hi-ui/src/apiServer.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/hi-ui/src/apiServer.js b/hi-ui/src/apiServer.js new file mode 100644 index 0000000..92f4dcc --- /dev/null +++ b/hi-ui/src/apiServer.js @@ -0,0 +1,29 @@ +import axios from 'axios'; + +export const apiServer = axios.create({ + baseURL: '/api/', +}); + +export async function boot() { + return apiServer.get('/boot'); +} + +export async function logIn(username, password) { + const data = { + name: username, + password, + }; + return apiServer.post('/auth/login', data); +} + +export async function logOut() { + return apiServer.post('/auth/logout', {}); +} + +export async function listChannels() { + return apiServer.get('/channels'); +} + +export async function createChannel(name) { + return apiServer.post('/channels', { name }); +} |
