|
@@ -17,8 +17,17 @@ const router = useRouter()
|
|
|
const handleToHome = async () => {
|
|
|
// 退出企业登录
|
|
|
await logoutToken(getToken(1))
|
|
|
+
|
|
|
+ // 有企业id则为求职者切换招聘者
|
|
|
+ // 切换招聘者时已将企业账户信息赋值给accountInfo,现退出企业登录后需将个人账户信息赋值给accountInfo
|
|
|
+ const isChangeRole = localStorage.getItem('enterpriseId')
|
|
|
+ if (isChangeRole) {
|
|
|
+ const perAccountData = JSON.parse(localStorage.getItem('perAccountInfo'))
|
|
|
+ localStorage.setItem('accountInfo', JSON.stringify(perAccountData))
|
|
|
+ } else localStorage.removeItem('accountInfo')
|
|
|
+
|
|
|
// 清除企业相关缓存信息
|
|
|
- const enterpriseLocalStorage = ['ENT_REFRESH_TOKEN', 'ENT_ACCESS_TOKEN', 'entBaseInfo', 'accountInfo', 'isAdmin', 'enterpriseUserAccount', 'entUpdatePassword', 'emailLoginInfo', 'enterpriseStore', 'enterpriseId']
|
|
|
+ const enterpriseLocalStorage = ['ENT_REFRESH_TOKEN', 'ENT_ACCESS_TOKEN', 'entBaseInfo', 'isAdmin', 'enterpriseUserAccount', 'entUpdatePassword', 'emailLoginInfo', 'enterpriseStore', 'enterpriseId']
|
|
|
enterpriseLocalStorage.forEach(e => localStorage.removeItem(e))
|
|
|
|
|
|
router.push('/')
|