Fix: show notification and clear input field after adding a model

This commit is contained in:
0xb00bface 2023-11-12 17:58:08 +01:00
parent 41ffd75d48
commit 98aa9bc148
1 changed files with 16 additions and 13 deletions

View File

@ -305,7 +305,7 @@
} }
let ctbrec = { let ctbrec = {
add: function(input, onsuccess) { add: function(input, duration, onsuccess) {
try { try {
let model = { let model = {
type: null, type: null,
@ -326,8 +326,11 @@
data: msg data: msg
}) })
.done(function(data) { .done(function(data) {
console.log(data);
if (data.status === 'success') { if (data.status === 'success') {
if (onsuccess) {
onsuccess.call(data); onsuccess.call(data);
}
$.notify('Model added', 'info'); $.notify('Model added', 'info');
} else { } else {
$.notify('Adding model failed', 'error'); $.notify('Adding model failed', 'error');