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,9 +40,19 @@ export default function ModelConvert(props: ModelConvertProps) {
base_model: model.base_model,
model_name: model.model_name,
};
convertModel(responseBody);
if (error) {
convertModel(responseBody)
.unwrap()
.then((payload) => {
dispatch(
addToast(
makeToast({
title: `${t('modelManager.modelConverted')}: ${model.model_name}`,
status: 'success',
})
)
);
})
.catch((error) => {
dispatch(
addToast(
makeToast({
@ -53,18 +63,7 @@ export default function ModelConvert(props: ModelConvertProps) {
})
)
);
}
if (data) {
dispatch(
addToast(
makeToast({
title: `${t('modelManager.modelConverted')}: ${model.model_name}`,
status: 'success',
})
)
);
}
});
};
return (