feat(DOC): 完整地审查了代码,更完整的注释说明

- 无代码修改
This commit is contained in:
tobegold574
2025-11-23 22:26:39 +08:00
parent 4e741a0523
commit c5853847ae
27 changed files with 119 additions and 110 deletions

View File

@@ -11,6 +11,7 @@ export class AuthError extends Error {
constructor(code: string, message: string, details?: unknown) {
super(message);
// 这个得删还有test文件里的也要删
this.name = 'AuthError';
this.code = code;
this.details = details;

View File

@@ -19,6 +19,7 @@ export class AuthEventManager {
this.listeners.set(event, []);
}
const eventListeners = this.listeners.get(event);
// 神人判断
if (eventListeners) {
eventListeners.push(listener);
}

View File

@@ -64,6 +64,7 @@ export class DefaultSessionManager {
*/
clearCache(): void {
this.currentUser = null;
// 神人判断,没用接口
// 清除存储适配器中的所有项(如果支持)
if ('clear' in this.storage && typeof this.storage.clear === 'function') {
this.storage.clear();

View File

@@ -13,7 +13,7 @@ import type {
// 事件类型定义
export type AuthEventType = 'login' | 'logout' | 'register' | 'session_expired' | 'session_authenticated' | 'session_logout';
// 事件监听器类型
// 事件监听器类型(就是函数)
export type AuthEventListener = (...args: unknown[]) => void;
// 存储适配器接口 - 仅用于非敏感数据存储不涉及session管理
@@ -77,6 +77,7 @@ export interface SessionManager {
}
// 扩展 Axios 请求配置以支持认证选项
// 其实没必要,因为是服务器端处理过期
declare module 'axios' {
interface AxiosRequestConfig {
skipAuth?: boolean;