Can login now without auth

This commit is contained in:
2020-06-19 16:55:11 +00:00
parent 527c84a81e
commit c1e688d824
5 changed files with 164 additions and 135 deletions

View File

@@ -452,28 +452,28 @@ export default {
///////////////////////////////////
// POST / PUT DATA TO API SERVER
//
async upsertEx(route, data) {
async upsertEx(route, data, noToken = false) {
try {
let that = this;
//determine if this is a new or existing record
let fetchOptions = undefined;
if (data) {
//data can be blank in a post that triggers an action
if (data.concurrency) {
//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 (window.$gz._.endsWith(route, "/0")) {
route = route.slice(0, -2);
}
}
//put?
if (data && data.concurrency) {
fetchOptions = that.fetchPutOptions(data);
} else {
//no data, so this is likely just a trigger post
fetchOptions = that.fetchPostOptions(data);
//post
//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 (window.$gz._.endsWith(route, "/0")) {
route = route.slice(0, -2);
}
if (noToken == false) {
fetchOptions = that.fetchPostOptions(data);
} else {
fetchOptions = that.fetchPostNoAuthOptions(data);
}
}
let r = await fetch(that.APIUrl(route), fetchOptions);
that.statusEx(r);
r = await that.extractBodyEx(r);