This commit is contained in:
2025-09-22 15:08:56 +08:00
parent d5fa814cd6
commit b789f206ae
2 changed files with 4 additions and 2 deletions

View File

@@ -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)
} }
// 清理前端状态 // 清理前端状态

View File

@@ -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) {}
} }