Правка и очистка

This commit is contained in:
Халимов Рустам
2026-03-16 15:22:29 +03:00
parent 1dd53e1c6a
commit 239b08b566
9 changed files with 19 additions and 30 deletions

View File

@@ -1,8 +1,10 @@
using Knot.Shared.Kernel.Configuration;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authorization;
namespace Host.Controllers;
[Authorize]
[ApiController]
[Route("api/[controller]")]
public class ConfigController : ControllerBase

View File

@@ -1,6 +0,0 @@
namespace Knot.Modules.Chats;
public class Class1
{
}

View File

@@ -1,6 +0,0 @@
namespace Knot.Modules.Identity;
public class Class1
{
}

View File

@@ -1,6 +0,0 @@
namespace Knot.Shared.Infrastructure;
public class Class1
{
}

View File

@@ -1,6 +0,0 @@
namespace Knot.Shared.Kernel;
public class Class1
{
}

View File

@@ -81,7 +81,11 @@ export default function EmojiPicker({ onSelect, onSelectGif, onClose }: EmojiPic
}, [tab, klipyApiKey, klipyCustomerId]);
const searchGifs = useCallback((q: string) => {
if (!klipyApiKey || !q.trim()) { setGifs([]); return; }
if (!klipyApiKey || !q.trim()) {
setGifs([]);
setGifLoading(false);
return;
}
setGifLoading(true);
fetch(`https://api.klipy.com/api/v1/${klipyApiKey}/gifs/search?page=1&per_page=30&q=${encodeURIComponent(q)}&customer_id=${klipyCustomerId}`)
.then(async (r) => {

View File

@@ -419,6 +419,7 @@ export default function MessageInput({ chatId }: MessageInputProps) {
fileSize: result.size
}],
replyToId: replyTo?.id || null,
quote: replyTo?.quote || null,
});
setReplyTo(null);
}
@@ -882,6 +883,7 @@ export default function MessageInput({ chatId }: MessageInputProps) {
fileSize: 0,
}],
replyToId: replyTo?.id || null,
quote: replyTo?.quote || null,
});
setReplyTo(null);
}

View File

@@ -64,6 +64,10 @@ class ApiClient {
return this.request<{ user: User }>('/auth/me');
}
async getConfig() {
return this.request<any>('/config');
}
// \u041f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438
async searchUsers(query: string) {
return this.request<UserPresence[]>(`/users/search?q=${encodeURIComponent(query)}`);

View File

@@ -25,11 +25,10 @@ export const useAuthStore = create<AuthState>((set, get) => ({
config: null,
fetchConfig: async () => {
if (!get().token) return;
try {
const res = await fetch('/api/config');
if (res.ok) {
set({ config: await res.json() });
}
const res = await api.getConfig();
set({ config: res });
} catch {}
},
@@ -41,6 +40,7 @@ export const useAuthStore = create<AuthState>((set, get) => ({
api.setToken(token);
connectSocket(token);
set({ token, user, isLoading: false });
await get().fetchConfig();
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
set({ error: msg, isLoading: false });
@@ -56,6 +56,7 @@ export const useAuthStore = create<AuthState>((set, get) => ({
api.setToken(token);
connectSocket(token);
set({ token, user, isLoading: false });
await get().fetchConfig();
} catch (err: unknown) {
const msg = err instanceof Error ? err.message : String(err);
set({ error: msg, isLoading: false });
@@ -71,7 +72,6 @@ export const useAuthStore = create<AuthState>((set, get) => ({
},
checkAuth: async () => {
get().fetchConfig();
const token = get().token;
if (!token) {
set({ isLoading: false });
@@ -86,6 +86,7 @@ export const useAuthStore = create<AuthState>((set, get) => ({
const { user } = await api.getMe();
connectSocket(token);
set({ user, isLoading: false });
await get().fetchConfig();
return;
} catch (err) {
lastError = err;