Refactor(Navigate): Optimize navigate

Unified management navigation
This commit is contained in:
2024-04-26 11:25:42 +08:00
parent 296a45df00
commit 64c510cd42
16 changed files with 220 additions and 82 deletions

View File

@@ -2,6 +2,7 @@ import Icon from '@ant-design/icons'
import { COLOR_ERROR } from '@/constants/common.constants'
import { getRedirectUrl } from '@/util/route'
import { getAvatar, getLoginStatus, getNickname, removeToken } from '@/util/auth'
import { navigateToLogin, navigateToUser } from '@/util/navigation'
import { r_auth_logout } from '@/services/auth'
const Footer = () => {
@@ -15,9 +16,9 @@ const Footer = () => {
const handleClickAvatar = () => {
if (getLoginStatus()) {
navigate('/user')
navigateToUser(navigate)
} else {
navigate(getRedirectUrl('/login', `${lastMatch.pathname}${location.search}`))
navigateToLogin(navigate, undefined, `${lastMatch.pathname}${location.search}`)
}
}