diff --git a/src/stores/ConversationStore.js b/src/stores/ConversationStore.js index 7a8de32..8d13508 100644 --- a/src/stores/ConversationStore.js +++ b/src/stores/ConversationStore.js @@ -301,10 +301,10 @@ export const useConversationStore = create( setInitial: (v) => set({ initialState: v }), // side effects - fetchInitialData: async (userId) => { - const { addToConversationList, setTemplates, setInitial, receivedMessageList } = get(); + fetchInitialData: async (userIds) => { + const { addToConversationList, setTemplates, setInitial, } = get(); - const conversationsList = await fetchConversationsList({ opisn: userId }); + const conversationsList = await fetchConversationsList({ opisn: userIds }); addToConversationList(conversationsList); const templates = await fetchTemplates(); diff --git a/src/views/AuthApp.jsx b/src/views/AuthApp.jsx index 9c85960..d6b3302 100644 --- a/src/views/AuthApp.jsx +++ b/src/views/AuthApp.jsx @@ -21,7 +21,7 @@ function AuthApp() { const navigate = useNavigate() const { colorPrimary, borderRadius } = useThemeContext() - const { loginUser } = useAuthStore() + const loginUser = useAuthStore(state => state.loginUser) const href = useHref() @@ -36,7 +36,7 @@ function AuthApp() { useEffect(() => { if (loginUser.userId > 0) { useConversationStore.getState().connectWebsocket(loginUser.userId); - useConversationStore.getState().fetchInitialData(loginUser.userId); + useConversationStore.getState().fetchInitialData(loginUser.userId); // userIdStr } return () => { useConversationStore.getState().disconnectWebsocket();