|
|
@@ -1,6 +1,6 @@
|
|
|
import { defineStore } from "pinia";
|
|
|
import { ref } from "vue";
|
|
|
-import { getCurrentUser } from "@/lib/api";
|
|
|
+import { getCurrentUser, getUnreadCount } from "@/lib/api";
|
|
|
import { getWsUrl } from "@/lib/utils";
|
|
|
import { toast } from "vue-sonner";
|
|
|
|
|
|
@@ -265,9 +265,12 @@ export const useAuthStore = defineStore("auth", () => {
|
|
|
}
|
|
|
|
|
|
async function refreshUnreadCount() {
|
|
|
- // Left empty or removed, as WS handles updates now.
|
|
|
- // If you need manual force, you could re-trigger connect or add an endpoint,
|
|
|
- // but the WS pushes update automatically.
|
|
|
+ try {
|
|
|
+ const { count } = await getUnreadCount();
|
|
|
+ unreadMessagesCount.value = count;
|
|
|
+ } catch (e) {
|
|
|
+ console.error("Failed to refresh unread count", e);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return {
|