feat: optimize web ui

This commit is contained in:
2026-04-02 18:22:14 +08:00
parent ccf76fea95
commit 143b1e8c4b
24 changed files with 1833 additions and 246 deletions

View File

@@ -9,6 +9,7 @@ type AuthContextType = {
login: (email: string, password: string) => Promise<void>;
register: (email: string, password: string, name: string) => Promise<void>;
logout: () => void;
updateUser: (updates: Partial<User>) => void;
};
const AuthContext = createContext<AuthContextType | null>(null);
@@ -48,8 +49,12 @@ export function AuthProvider({ children }: { children: ReactNode }) {
const logout = () => { clearTokens(); setUser(null); };
const updateUser = (updates: Partial<User>) => {
setUser(prev => prev ? { ...prev, ...updates } : null);
};
return (
<AuthContext.Provider value={{ user, loading, login, register, logout }}>
<AuthContext.Provider value={{ user, loading, login, register, logout, updateUser }}>
{children}
</AuthContext.Provider>
);