F #5637: Fix notification after create template (#1695)

This commit is contained in:
Sergio Betanzos authored and GitHub committed 2022-01-11 19:02:16 +01:00
1 parent fa92ef7bbc
commit 374072908c
1 file changed
+5 -5
@@ -35,14 +35,14 @@ function CreateVmTemplate() {
const { enqueueSuccess } = useGeneralApi()
const { update, allocate } = useVmTemplateApi()
const onSubmit = async (template) => {
const onSubmit = async (xmlTemplate) => {
try {
if (templateId === undefined) {
await allocate(template)
if (!templateId) {
const newTemplateId = await allocate(xmlTemplate)
history.push(PATH.TEMPLATE.VMS.LIST)
enqueueSuccess(`VM Template created - #${templateId}`)
enqueueSuccess(`VM Template created - #${newTemplateId}`)
} else {
await update(templateId, template)
await update(templateId, xmlTemplate)
history.push(PATH.TEMPLATE.VMS.LIST)
enqueueSuccess(`VM Template updated - #${templateId} ${NAME}`)
}