diff --git a/src/assets/error.svg b/src/assets/error.svg
new file mode 100644
index 0000000..e2e0b35
--- /dev/null
+++ b/src/assets/error.svg
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/src/assets/loading.svg b/src/assets/loading.svg
new file mode 100644
index 0000000..a536af8
--- /dev/null
+++ b/src/assets/loading.svg
@@ -0,0 +1,6 @@
+
\ No newline at end of file
diff --git a/src/index.tsx b/src/index.tsx
index 64783a4..eef1653 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -4,6 +4,7 @@ import {HashRouter, Route} from "@solidjs/router";
import "./index.css";
import {Index} from "./pages/Index";
+import {Lobby} from "./pages/Lobby";
const root = document.getElementById("root");
@@ -15,6 +16,7 @@ render(
() => (
+
),
root!,
diff --git a/src/pages/Lobby.tsx b/src/pages/Lobby.tsx
new file mode 100644
index 0000000..597d7f8
--- /dev/null
+++ b/src/pages/Lobby.tsx
@@ -0,0 +1,77 @@
+import { Show, createSignal, onMount } from "solid-js";
+import LoadingIcon from "../assets/loading.svg";
+import ErrorIcon from "../assets/error.svg";
+
+enum LobbyStatus {
+ Connecting,
+ Connected,
+ Disconnected,
+ Error,
+}
+
+export function Lobby() {
+ const [status, setStatus] = createSignal(LobbyStatus.Connecting);
+ let ws: WebSocket|null = null;
+
+ const lobbyConnect = async() => {
+ ws = new WebSocket(`${import.meta.env.VITE_WS_URL}/lobby/connect`);
+
+ ws.addEventListener("open", () => {
+ console.log("Connection open!");
+ setStatus(LobbyStatus.Connected);
+ });
+
+ ws.addEventListener("message", (ev) => {
+ console.log("message from ws!");
+ console.log(ev);
+ });
+
+ ws.addEventListener("error", (ev) => {
+ console.error(ev);
+ setStatus(LobbyStatus.Error);
+ });
+
+ ws.addEventListener("close", () => {
+ console.log("connection closed");
+ });
+ };
+
+ const send = () => {
+ if (ws === null) {
+ setStatus(LobbyStatus.Disconnected);
+ return;
+ }
+
+ const message = "hello SEKAI";
+ ws.send(message);
+ };
+
+ onMount(lobbyConnect);
+
+ return (
+
+
+ Lobby
+
+
+
+
+
+ Connecting to the lobby
+
+
+
+
+
+
+ Error connecting to the lobby
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/utils.ts b/src/utils.ts
index 083f03f..298471c 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -1,7 +1,7 @@
import axios from "axios";
export let backend = axios.create({
- baseURL: `${import.meta.env.VITE_BACKEND_URL}/api`,
+ baseURL: `${import.meta.env.VITE_BACKEND_URL}`,
headers: {
"Authorization": `Bearer ${localStorage.getItem("UserId") ?? ""}`,
},
@@ -9,7 +9,7 @@ export let backend = axios.create({
export function set_auth_token(token: string) {
backend = axios.create({
- baseURL: `${import.meta.env.VITE_BACKEND_URL}/api`,
+ baseURL: `${import.meta.env.VITE_BACKEND_URL}`,
headers: {
"Authorization": `Bearer ${token}`,
},