This commit is contained in:
2019-06-06 18:15:18 +00:00
parent 629b93295e
commit f894c012b5
3 changed files with 36 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
/* Xeslint-disable */
import _ from "../libs/lodash.min.js";
import store from "../store";
import router from "../router";
import auth from "./auth";
@@ -284,9 +285,15 @@ export default {
//determine if this is a new or existing record
var fetchOptions = undefined;
if (data.concurrencyToken) {
//has concurrency token, so this is a PUT as it's updating an existing record
fetchOptions = that.fetchPutOptions(data);
} else {
//Does not have a concurrency token so this is a POST as it's posting a new record without a concurrency token
fetchOptions = that.fetchPostOptions(data);
//ensure the route doesn't end in /0 which will happen if it's a new record since the edit forms just send the url here with the ID regardless
if (_.endsWith(route, "/0")) {
route = route.slice(0, -2);
}
}
fetch(that.APIUrl(route), fetchOptions)
.then(that.status)