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

useRegisterAsset

@mineflow/client-react


@mineflow/client-react / useRegisterAsset

Function: useRegisterAsset()

function useRegisterAsset(): UseMutationResult<{
assetClassId: string;
commissionedAt: string;
currentObjectId: string;
id: string;
inventoryNumber: string;
name: string;
passport: {
manufacturer: string;
model: string;
productionYear: number;
specifications: {
[key: string]: unknown;
};
};
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;
};
};
responsibleMechanicId?: string;
}>;

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

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

Returns

UseMutationResult<{ assetClassId: string; commissionedAt: string; currentObjectId: string; id: string; inventoryNumber: string; name: string; passport: { manufacturer: string; model: string; productionYear: number; specifications: { [key: string]: unknown; }; }; 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; }; }; responsibleMechanicId?: string; }>

UseMutationResultmutate(body: RegisterAssetBody).

Example

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