14-04-2026

Промежуточный комит версии в которой ну хоть какието тестовые уведомления приходят. Но пока ещё вебпуш не работает
This commit is contained in:
AidarKC
2026-04-14 23:53:54 +03:00
parent 24be1d0c1f
commit 21fbc8ffa0
7 changed files with 140 additions and 53 deletions
+13 -1
View File
@@ -197,6 +197,7 @@ export const state = createInitialState();
export const authService = new AuthService(state.entrySettings.shineServer);
let onSessionReset = null;
let onSessionAuthorized = null;
export function getChatMessages(chatId) {
if (!state.chats[chatId]) {
@@ -321,7 +322,11 @@ export function clearAuthMessages() {
state.authUi.info = '';
}
export function authorizeSession({ login, sessionId, storagePwd }) {
export function authorizeSession({
login = state.session.login,
sessionId = state.session.sessionId,
storagePwd = state.session.storagePwdInMemory,
} = {}) {
state.session.isAuthorized = true;
state.session.login = login;
state.session.sessionId = sessionId;
@@ -332,12 +337,19 @@ export function authorizeSession({ login, sessionId, storagePwd }) {
sessionId,
});
state.startHint = '';
if (onSessionAuthorized) {
onSessionAuthorized();
}
}
export function setSessionResetHandler(handler) {
onSessionReset = typeof handler === 'function' ? handler : null;
}
export function setSessionAuthorizedHandler(handler) {
onSessionAuthorized = typeof handler === 'function' ? handler : null;
}
export function isSessionInvalidError(error) {
return INVALID_SESSION_CODES.has(error?.code);
}