Fix ping on credential restoration

This commit is contained in:
2025-09-24 20:14:47 +03:00
Unverified
parent f98b91ea3c
commit 7e09cd2c7c
2 changed files with 37 additions and 6 deletions
+16 -5
View File
@@ -1,5 +1,5 @@
import { create } from "zustand";
import type { Message, User, WebSocketMessage } from "../core/types";
import type { Message, User } from "../core/types";
import { request } from "../core/websocket";
import { MessagePanel } from "./panels/MessagePanel";
import { PublicChatPanel } from "./panels/PublicChatPanel";
@@ -166,16 +166,14 @@ export const useAppState = create<AppState>((set, get) => ({
}
try {
const payload: WebSocketMessage = {
request({
type: "ping",
credentials: {
scheme: "Bearer",
credentials: token
},
data: {}
}
request(payload).then(() => {
}).then(() => {
console.log("Ping succeeded")
})
} catch {}
@@ -218,6 +216,19 @@ export const useAppState = create<AppState>((set, get) => ({
currentPage: "chat"
}));
try {
request({
type: "ping",
credentials: {
scheme: "Bearer",
credentials: token
},
data: {}
}).then(() => {
console.log("Ping succeeded")
})
} catch {}
// Initialize notifications after successful credential restoration
try {
if (isSupported()) {