perf: optimize load of pagination items with caching
This commit is contained in:
@ -22,12 +22,15 @@ export const JoinGuildsPublic: React.FC = () => {
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
authentication.socket.on('guilds', (data: SocketData<GuildPublicType>) => {
|
||||
handleSocketData({ data, setItems })
|
||||
})
|
||||
authentication?.socket?.on(
|
||||
'guilds',
|
||||
(data: SocketData<GuildPublicType>) => {
|
||||
handleSocketData({ data, setItems })
|
||||
}
|
||||
)
|
||||
|
||||
return () => {
|
||||
authentication.socket.off('guilds')
|
||||
authentication?.socket?.off('guilds')
|
||||
}
|
||||
}, [authentication.socket, setItems])
|
||||
|
||||
|
@ -72,7 +72,7 @@ export const Authentication: React.FC<AuthenticationProps> = (props) => {
|
||||
} else {
|
||||
try {
|
||||
const { data } = await api.post<Tokens>('/users/signin', formData)
|
||||
const authentication = new AuthenticationClass(data)
|
||||
const authentication = new AuthenticationClass(data, true)
|
||||
authentication.signin()
|
||||
await router.push('/application')
|
||||
return null
|
||||
|
@ -24,7 +24,7 @@ export const AuthenticationSocialMedia: React.FC = () => {
|
||||
useEffect(() => {
|
||||
const data = router.query
|
||||
if (isTokens(data)) {
|
||||
const authentication = new Authentication(data)
|
||||
const authentication = new Authentication(data, true)
|
||||
authentication.signin()
|
||||
router.push('/application').catch(() => {})
|
||||
}
|
||||
|
Reference in New Issue
Block a user