Add product name variable and fix bugs

This commit is contained in:
2025-08-19 18:59:44 +03:00
Unverified
parent a5a501e364
commit 317f66d6b8
4 changed files with 17 additions and 12 deletions
+2 -1
View File
@@ -1,2 +1,3 @@
export const API_BASE_URL: string = '/api';
export const API_FULL_BASE_URL: string = "localhost:8301/api"
export const API_FULL_BASE_URL: string = "localhost:8301/api";
export const PRODUCT_NAME: string = "FromChat";
+8 -2
View File
@@ -1,6 +1,6 @@
import './css/style.scss';
import { showLogin, getAuthHeaders, authToken, currentUser } from './auth';
import { API_BASE_URL, API_FULL_BASE_URL } from './config';
import { API_BASE_URL, API_FULL_BASE_URL, PRODUCT_NAME } from './config';
import type { Message, Messages, WebSocketMessage } from './types';
import "./links";
@@ -120,6 +120,10 @@ export function sendMessage() {
}
// --------------
// Initialization
// --------------
websocket.addEventListener("message", (e) => {
const message: WebSocketMessage = JSON.parse(e.data);
switch (message.type) {
@@ -136,4 +140,6 @@ showLogin();
document.getElementById('message-form')!.addEventListener('submit', (e) => {
e.preventDefault();
sendMessage();
});
});
document.getElementById("productname")!.textContent = PRODUCT_NAME;