Presupuestador_web/client/src/lib/hooks/useAuth/AuthActions.ts
2024-07-09 18:21:12 +02:00

44 lines
1.3 KiB
TypeScript

import { IIdentity_Response_DTO } from "@shared/contexts";
export type SuccessNotificationResponse = {
message: string;
description?: string;
};
export type PermissionResponse = unknown;
export type IdentityResponse = IIdentity_Response_DTO | null;
export type AuthActionCheckResponse = {
authenticated: boolean;
redirectTo?: string;
logout?: boolean;
error?: Error;
};
export type AuthActionOnErrorResponse = {
redirectTo?: string;
logout?: boolean;
error?: Error;
};
export type AuthActionResponse = {
success: boolean;
redirectTo?: string;
error?: Error;
[key: string]: unknown;
successNotification?: SuccessNotificationResponse;
};
export interface IAuthActions {
login: (params: any) => Promise<AuthActionResponse>;
logout: (params: any) => Promise<AuthActionResponse>;
check: () => Promise<AuthActionCheckResponse>;
onError?: (error: any) => Promise<AuthActionOnErrorResponse>;
register?: (params: unknown) => Promise<AuthActionResponse>;
forgotPassword?: (params: unknown) => Promise<AuthActionResponse>;
updatePassword?: (params: unknown) => Promise<AuthActionResponse>;
getPermissions?: (params?: Record<string, unknown>) => Promise<PermissionResponse>;
getIdentity?: (params?: unknown) => Promise<IdentityResponse>;
}