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)

View File

@@ -86,7 +86,7 @@ export default function initialize() {
api
.get("UserOptions/" + store.state.userId)
.then(res => {
if (res.error) {
if (res.error != undefined) {
//In a form this would trigger a bunch of validation or error display code but for here and now:
//convert error to human readable string for display and popup a notification to user
var msg = api.apiErrorToHumanString(res.error);