Optimize code

This commit is contained in:
2023-12-27 10:06:43 +08:00
parent 647b203b6a
commit 4eec5092ff
3 changed files with 16 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ import React, { useState } from 'react'
import Icon from '@ant-design/icons'
import { COLOR_ERROR } from '@/constants/common.constants'
import { getRedirectUrl } from '@/util/route'
import { useUpdatedEffect } from '@/util/hooks'
import { getAvatar, getLoginStatus, getNickname, removeToken } from '@/util/auth'
import { r_auth_logout } from '@/services/auth'
@@ -42,7 +43,7 @@ const SidebarFooter: React.FC = () => {
const loginStatus = getLoginStatus()
useEffect(() => {
useUpdatedEffect(() => {
if (getLoginStatus()) {
void getNickname().then((nickname) => {
setNickname(nickname)