Fixing error on client creation

This commit is contained in:
Fabian Stamm 2018-11-10 18:56:32 +01:00
parent 6580cbf667
commit 24f4f12845

View File

@ -145,7 +145,7 @@ Handlebars.registerHelper("formatDate", function (datetime, format) {
console.log(data); console.log(data);
let id = data._id; let id = data._id;
delete data._id; delete data._id;
if (id !== "") { if (id && id !== "") {
request("/api/admin/client?id=" + id, "PUT", data).then(() => setCustomCard()).then(() => loadList()).catch(catchError) request("/api/admin/client?id=" + id, "PUT", data).then(() => setCustomCard()).then(() => loadList()).catch(catchError)
} else { } else {
request("/api/admin/client", "POST", data).then(() => setCustomCard()).then(() => loadList()).catch(catchError) request("/api/admin/client", "POST", data).then(() => setCustomCard()).then(() => loadList()).catch(catchError)