9s-fe-core
Version:
Core functionalities for authentication, configuration, and repository management.
31 lines (30 loc) • 920 B
TypeScript
import React from 'react';
import { AuthUser, LoginResponse, ProfileResponse } from './login/types';
export interface AuthProviderOptions {
routes?: {
loginPath?: string;
defaultProtectedPath?: string;
};
callbacks?: {
onLoginSuccess?: (user: AuthUser) => void;
onLogout?: () => void;
};
}
interface AuthContextType {
isAuthenticated: boolean;
user: AuthUser | null;
login: (loginResponse: LoginResponse) => void;
logout: () => void;
isLoading: boolean;
refreshUserProfile: () => Promise<ProfileResponse | null>;
}
export declare const useAuth: () => AuthContextType;
interface AuthProviderProps {
children: React.ReactNode;
loginPath: string;
defaultProtectedPath: string;
onLoginSuccess?: (user: AuthUser) => void;
onLogout?: () => void;
}
declare const AuthProvider: React.FC<AuthProviderProps>;
export default AuthProvider;