1
This commit is contained in:
@@ -128,10 +128,9 @@ async function handleLoginSuccess(data: { token: string; permissions?: string })
|
|||||||
}
|
}
|
||||||
async function logout() {
|
async function logout() {
|
||||||
try {
|
try {
|
||||||
// 删除后端token缓存 - 复刻HTML版本逻辑
|
|
||||||
await fetch('/api/cache/delete?key=token', { method: 'POST' })
|
await fetch('/api/cache/delete?key=token', { method: 'POST' })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('删除后端token缓存失败:', e)
|
console.log('删除后端token缓存失败:', e)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 清理前端状态
|
// 清理前端状态
|
||||||
|
|||||||
@@ -238,8 +238,11 @@ public class AuthServiceImpl implements IAuthService {
|
|||||||
*/
|
*/
|
||||||
public void logout() {
|
public void logout() {
|
||||||
try {
|
try {
|
||||||
|
// 清除内存中的token
|
||||||
accessToken = null;
|
accessToken = null;
|
||||||
refreshToken = null;
|
refreshToken = null;
|
||||||
|
|
||||||
|
// 删除SQLite中的token缓存
|
||||||
cacheDataRepository.deleteByCacheKey("token");
|
cacheDataRepository.deleteByCacheKey("token");
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user