Промежуточный комит для отдачи задания брату

This commit is contained in:
AidarKC
2026-04-03 10:50:44 +03:00
parent c0fba4af94
commit 78e62997d1
40 changed files with 324 additions and 122 deletions
+23 -3
View File
@@ -1,6 +1,6 @@
import { chatMessages, wallet } from './mock-data.js?v=20260330001044';
import { AuthService } from './services/auth-service.js?v=20260330001044';
import { clearClientAuthData } from './services/key-vault.js?v=20260330001044';
import { chatMessages, wallet } from './mock-data.js?v=20260330210201';
import { AuthService } from './services/auth-service.js?v=20260330210201';
import { clearClientAuthData } from './services/key-vault.js?v=20260330210201';
const clone = (value) => JSON.parse(JSON.stringify(value));
const SESSION_STORAGE_KEY = 'shine-ui-current-session-v1';
@@ -99,6 +99,7 @@ function createInitialState({ withStoredSession = true } = {}) {
sessions: [],
channelsFeed: null,
channelsIndex: {},
localChannelPosts: {},
};
}
@@ -239,3 +240,22 @@ export function setChannelsFeed(feed, index) {
state.channelsFeed = feed || null;
state.channelsIndex = index || {};
}
export function getLocalChannelPosts(channelId) {
if (!channelId) return [];
if (!state.localChannelPosts[channelId]) {
state.localChannelPosts[channelId] = [];
}
return state.localChannelPosts[channelId];
}
export function addLocalChannelPost(channelId, post) {
if (!channelId) return;
const text = post?.body?.trim();
if (!text) return;
getLocalChannelPosts(channelId).push({
title: post.title || `${state.session.login || 'Вы'} • сейчас`,
body: text,
});
}