[mod] minor adjustments
Christian Fraß

Christian Fraß commited on 2021-11-19 17:39:51
Zeige 4 geänderte Dateien mit 8 Einfügungen und 5 Löschungen.

... ...
@@ -2,7 +2,8 @@
2 2
 	"backend": {
3 3
 		"scheme": "http",
4 4
 		"host": "localhost",
5
-		"port": 7979
5
+		"port": 7979,
6
+		"path": ""
6 7
 	},
7 8
 	"settings": {
8 9
 		"poll_interval_in_milliseconds": 2000
... ...
@@ -33,4 +33,5 @@ A simple IRC client, realized as web application
33 33
 
34 34
 - support multiple channels and private messages
35 35
 - support commands (e.g. `/nick new_name`)
36
+- get correct user list (seems like it does not update when a user leaves the room)
36 37
 
... ...
@@ -10,7 +10,7 @@
10 10
 	</head>
11 11
 	<body class="offline">
12 12
 		<div id="connect">
13
-			<form action="#">
13
+			<form action="?">
14 14
 				<div class="field">
15 15
 					<label>nickname</label>
16 16
 					<input type="text" id="nickname" placeholder="nickname"/>
... ...
@@ -38,10 +38,10 @@
38 38
 				<ul class="pane" id="events"></ul>
39 39
 				<ul class="pane" id="users"></ul>
40 40
 			</div>
41
-			<form action="#">
41
+			<form action="?">
42 42
 				<input type="text" id="message" placeholder="…"/>
43 43
 				<input type="submit" id="send" value="send"/>
44 44
 			</form>
45
-		</template>
45
+		</div>
46 46
 	</body>
47 47
 </html>
... ...
@@ -28,7 +28,7 @@ async function backend_call(action: string, data: any): Promise<any>
28 28
 {
29 29
 	const response = await fetch
30 30
 	(
31
-		`${_conf.backend.scheme}://${_conf.backend.host}:${_conf.backend.port.toFixed(0)}`,
31
+		`${_conf["backend"]["scheme"]}://${_conf["backend"]["host"]}:${_conf["backend"]["port"].toFixed(0)}/${_conf["backend"]["path"]}`,
32 32
 		{
33 33
 			"method": "POST",
34 34
 			"body": JSON.stringify({"action": action, "id": _model.connection_id, "data": data}),
... ...
@@ -232,6 +232,7 @@ function setup_control(): void
232 232
 		"submit",
233 233
 		async (event) =>
234 234
 		{
235
+			event.preventDefault();
235 236
 			let dom_nickname: HTMLInputElement = document.querySelector<HTMLInputElement>("#nickname");
236 237
 			let dom_channel: HTMLInputElement = document.querySelector<HTMLInputElement>("#channel");
237 238
 			const nickname: string = dom_nickname.value;
238 239