mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Empty msg fix, unread after opening msg fix
This commit is contained in:
parent
02954e0d01
commit
98164ff4fa
2 changed files with 13 additions and 15 deletions
|
@ -7,7 +7,7 @@ import Layout from '../components/layout'
|
|||
import '../defaultStyles.css'
|
||||
import constants from '../constants.json'
|
||||
|
||||
const queryClient = new QueryClient({
|
||||
export const queryClient = new QueryClient({
|
||||
defaultOptions: {
|
||||
queries: {
|
||||
staleTime: Infinity,
|
||||
|
@ -44,20 +44,12 @@ const getGlobalProps = () => {
|
|||
}
|
||||
|
||||
function App({ Component, pageProps, router }) {
|
||||
const [userId, setUserId] = useState()
|
||||
const [motd, setMotd] = useState()
|
||||
const [unreads, setUnreads] = useState()
|
||||
const [globalState, setGlobalState] = useState({})
|
||||
const { data } = useQuery('hasNewMsgs', () => getGlobalProps(), {
|
||||
const { data } = useQuery(['infos'], () => getGlobalProps(), {
|
||||
refetchOnWindowFocus: true,
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
if (!data) return
|
||||
setUserId(data.uid)
|
||||
setMotd(data.motd)
|
||||
setUnreads(data.unreads)
|
||||
}, [data])
|
||||
const { motd, uid: userId, unreads } = data || {}
|
||||
|
||||
useEffect(() => {
|
||||
getGlobalProps()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue