feat(ui): add model convert for success/failure handling

This commit is contained in:
psychedelicious 2023-07-14 17:39:00 +10:00
parent 6d7fb49a7a
commit f2af82bf73

View File

@ -40,31 +40,30 @@ export default function ModelConvert(props: ModelConvertProps) {
base_model: model.base_model,
model_name: model.model_name,
};
convertModel(responseBody);
if (error) {
dispatch(
addToast(
makeToast({
title: `${t('modelManager.modelConversionFailed')}: ${
model.model_name
}`,
status: 'error',
})
)
);
}
if (data) {
dispatch(
addToast(
makeToast({
title: `${t('modelManager.modelConverted')}: ${model.model_name}`,
status: 'success',
})
)
);
}
convertModel(responseBody)
.unwrap()
.then((payload) => {
dispatch(
addToast(
makeToast({
title: `${t('modelManager.modelConverted')}: ${model.model_name}`,
status: 'success',
})
)
);
})
.catch((error) => {
dispatch(
addToast(
makeToast({
title: `${t('modelManager.modelConversionFailed')}: ${
model.model_name
}`,
status: 'error',
})
)
);
});
};
return (