2023-05-18 11:09:31 -07:00
|
|
|
import React from 'react';
|
2023-03-28 20:36:21 +08:00
|
|
|
import {
|
|
|
|
|
RecoilRoot,
|
|
|
|
|
atom,
|
|
|
|
|
selector,
|
|
|
|
|
useRecoilState,
|
|
|
|
|
useRecoilValue,
|
2023-05-18 11:09:31 -07:00
|
|
|
useSetRecoilState
|
|
|
|
|
} from 'recoil';
|
2023-03-28 20:36:21 +08:00
|
|
|
|
|
|
|
|
const refreshConversationsHint = atom({
|
2023-05-18 11:09:31 -07:00
|
|
|
key: 'refreshConversationsHint',
|
|
|
|
|
default: 1
|
2023-03-28 20:36:21 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const useConversations = () => {
|
2023-05-18 11:09:31 -07:00
|
|
|
const setRefreshConversationsHint = useSetRecoilState(refreshConversationsHint);
|
2023-03-28 20:36:21 +08:00
|
|
|
|
2023-05-18 11:09:31 -07:00
|
|
|
const refreshConversations = () => setRefreshConversationsHint(prevState => prevState + 1);
|
2023-03-28 20:36:21 +08:00
|
|
|
|
|
|
|
|
return { refreshConversations };
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default { refreshConversationsHint, useConversations };
|