Improve code

This commit is contained in:
2025-09-05 19:39:40 +03:00
Unverified
parent e50e94327d
commit 5ceca6778b
3 changed files with 67 additions and 18 deletions
+61 -11
View File
@@ -2,9 +2,9 @@
"version": "2.0.0",
"tasks": [
{
"label": "Run",
"type": "shell",
"command": "npm run dev",
"label": "Backend",
"type": "npm",
"script": "backend:run",
"options": {
"cwd": "${workspaceFolder}"
},
@@ -16,23 +16,73 @@
},
"group": {
"kind": "build"
},
"isBackground": true
},
{
"label": "Frontend (Web)",
"type": "npm",
"script": "frontend:dev",
"options": {
"cwd": "${workspaceFolder}"
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"group": {
"kind": "build",
},
"isBackground": true
},
{
"label": "Frontend (Electron)",
"type": "npm",
"script": "frontend:electron:dev",
"options": {
"cwd": "${workspaceFolder}"
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"group": {
"kind": "build"
},
"isBackground": true
},
{
"label": "Web",
"dependsOn": ["Backend", "Frontend (Web)"],
"dependsOrder": "parallel",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
}
},
{
"label": "Run (Electron)",
"type": "shell",
"command": "npm run dev:electron",
"options": {
"cwd": "${workspaceFolder}"
"label": "Electron",
"dependsOn": ["Backend", "Frontend (Electron)"],
"dependsOrder": "parallel",
"group": {
"kind": "build"
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared"
},
"group": {
"kind": "build"
}
}
]
+1 -2
View File
@@ -2,7 +2,7 @@ import { useEffect, useCallback, useRef } from "react";
import { useAppState } from "../state";
import { request, websocket } from "../../websocket";
import { API_BASE_URL } from "../../core/config";
import type { Message, WebSocketMessage, User } from "../../core/types";
import type { Message, WebSocketMessage } from "../../core/types";
import { getAuthHeaders } from "../../auth/api";
export function useChat() {
@@ -87,7 +87,6 @@ export function useChat() {
break;
case 'newMessage':
if (response.data) {
const isAuthor = response.data.username === user.currentUser?.username;
addMessage(response.data);
}
break;
+1 -1
View File
@@ -1,5 +1,5 @@
import { create } from "zustand";
import type { Message, User, UserProfile, WebSocketMessage } from "../core/types";
import type { Message, User, WebSocketMessage } from "../core/types";
import { request } from "../websocket";
type Page = "login" | "register" | "chat"