Перейти к основному содержимому

useRegisterAsset

@mineflow/client-react


@mineflow/client-react / EAM / useRegisterAsset

Function: useRegisterAsset()

function useRegisterAsset(): UseMutationResult<{
assetClassId: string;
commissionedAt: string;
currentObjectId: string;
id: string;
inventoryNumber: string;
name: string;
passport: {
manufacturer: string | null;
model: string | null;
productionYear: number | null;
specifications: {
[key: string]: unknown;
};
techPassportNumber: string | null;
warrantyMonths: number | null;
warrantyTermsText: string | null;
warrantyUntil: string | null;
};
responsibleMechanicId: string | null;
status: AssetResponse_OutputStatus;
}, Error, {
assetClassId: string;
commissionedAt: string;
currentObjectId: string;
inventoryNumber: string;
name: string;
passport: {
manufacturer: string;
model: string;
productionYear: number;
specifications: {
[key: string]: unknown;
};
techPassportNumber?: string;
warrantyMonths?: number;
warrantyTermsText?: string;
warrantyUntil?: string;
};
responsibleMechanicId?: string;
}>;

Defined in: client-react/src/domain-hooks/eam.ts:90

Регистрация (создание) нового актива. Авто-Idempotency-Key; на успехе инвалидирует список активов.

Returns​

UseMutationResult<{ assetClassId: string; commissionedAt: string; currentObjectId: string; id: string; inventoryNumber: string; name: string; passport: { manufacturer: string | null; model: string | null; productionYear: number | null; specifications: { [key: string]: unknown; }; techPassportNumber: string | null; warrantyMonths: number | null; warrantyTermsText: string | null; warrantyUntil: string | null; }; responsibleMechanicId: string | null; status: AssetResponse_OutputStatus; }, Error, { assetClassId: string; commissionedAt: string; currentObjectId: string; inventoryNumber: string; name: string; passport: { manufacturer: string; model: string; productionYear: number; specifications: { [key: string]: unknown; }; techPassportNumber?: string; warrantyMonths?: number; warrantyTermsText?: string; warrantyUntil?: string; }; responsibleMechanicId?: string; }>

UseMutationResult — mutate(body: RegisterAssetBody).

Example​

const register = useRegisterAsset();
register.mutate({ inventoryNumber: 'BG-001', name: '...', assetClassId, currentObjectId });