summaryrefslogtreecommitdiff
path: root/hi-ui/src/apiServer.js
diff options
context:
space:
mode:
authorKit La Touche <kit@transneptune.net>2024-09-19 23:26:39 -0400
committerKit La Touche <kit@transneptune.net>2024-09-27 16:10:36 -0400
commit1d8b828d1bbe0e0daa64f6fc2689799c7169afa0 (patch)
treec51149769901f733e6ec159597d185a0cefeea15 /hi-ui/src/apiServer.js
parent80af9cfb858dd18bc1cf26ce213aecd52bd8fc7b (diff)
Add basic browser client
Using Svelte. No tests, no linting, yet. This is just starting to get familiar with things. You'll still have to run the dev server and the dev client builder each in their own terminals. Enjoy!
Diffstat (limited to 'hi-ui/src/apiServer.js')
-rw-r--r--hi-ui/src/apiServer.js29
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 });
+}