resolve issues with new features
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import React, { createContext, useCallback, useContext, useState, useEffect, ReactNode } from 'react';
|
||||
import { AuthContextType, AuthState, User } from '../types/auth.types';
|
||||
import { AuthContextType, AuthState } from '../types/auth.types';
|
||||
import { authService } from '../services/auth';
|
||||
import { getToken, setToken, removeToken, getUser, setUser, removeUser, setRefreshToken, removeRefreshToken } from '../utils/storage';
|
||||
import { useNotification } from './NotificationContext';
|
||||
|
||||
@@ -22,11 +22,20 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({ children }) => {
|
||||
const [selectedRoomToken, setSelectedRoomToken] = useState<string | null>(null);
|
||||
const { chatPanelOpen } = useLayout();
|
||||
|
||||
const { data: connData } = useQuery({
|
||||
queryKey: ['nextcloud', 'connection'],
|
||||
queryFn: () => nextcloudApi.getConversations(),
|
||||
refetchInterval: chatPanelOpen ? 30000 : 120000,
|
||||
retry: false,
|
||||
});
|
||||
|
||||
const isConnected = connData?.connected ?? false;
|
||||
|
||||
const { data } = useQuery({
|
||||
queryKey: ['nextcloud', 'rooms'],
|
||||
queryFn: () => nextcloudApi.getRooms(),
|
||||
refetchInterval: chatPanelOpen ? 30000 : 120000,
|
||||
enabled: true,
|
||||
enabled: isConnected,
|
||||
});
|
||||
|
||||
const rooms = data?.rooms ?? [];
|
||||
|
||||
@@ -21,7 +21,7 @@ interface NotificationProviderProps {
|
||||
}
|
||||
|
||||
export const NotificationProvider: React.FC<NotificationProviderProps> = ({ children }) => {
|
||||
const [notifications, setNotifications] = useState<Notification[]>([]);
|
||||
const [_notifications, setNotifications] = useState<Notification[]>([]);
|
||||
const [currentNotification, setCurrentNotification] = useState<Notification | null>(null);
|
||||
|
||||
const addNotification = useCallback((message: string, severity: AlertColor) => {
|
||||
|
||||
Reference in New Issue
Block a user