updated login and register to use oauth
This commit is contained in:
+12
-34
@@ -110,7 +110,9 @@ const hashAPIPath = (queryPath) => {
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
return "&hash=" + hashlink;
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (hashPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export const getBasicSearch = (token, searchString) => {
|
||||
@@ -990,19 +992,11 @@ export const getEmailAccountCheck = (emailAddress) => {
|
||||
};
|
||||
|
||||
export const createAccount = (formValues) => {
|
||||
var data = JSON.stringify(formValues);
|
||||
var data = formValues; //JSON.stringify(formValues);
|
||||
var queryUrl = "/api/proxy/contacts";
|
||||
var config = {
|
||||
method: "post",
|
||||
url: queryUrl + hashAPIPath(queryUrl),
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": getToken(),
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
// console.log(config);
|
||||
@@ -1016,48 +1010,32 @@ export const createAccount = (formValues) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const updateAccount = (contactId, updateBody) => {
|
||||
var data = JSON.stringify(updateBody);
|
||||
export const updateAccount = async (contactId, updateBody) => {
|
||||
var data = updateBody; //JSON.stringify(updateBody);
|
||||
var queryUrl = "/api/proxy/contacts(" + contactId + ")";
|
||||
queryUrl = queryUrl + hashAPIPath(queryUrl);
|
||||
var config = {
|
||||
method: "patch",
|
||||
url: queryUrl + hashAPIPath(queryUrl),
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": getToken(),
|
||||
},
|
||||
url: queryUrl,
|
||||
data: data,
|
||||
};
|
||||
// console.log(config);
|
||||
return axios(config)
|
||||
.then((res) => {
|
||||
//console.log("posted ", res.data);
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("this serror", error);
|
||||
console.log("this error:", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const updatePassword = (contactId, newpassword) => {
|
||||
let updateBody = { "pinswg_custom_password": newpassword };
|
||||
var data = JSON.stringify(updateBody);
|
||||
var data = updateBody; //JSON.stringify(updateBody);
|
||||
var queryUrl = "/api/proxy/contacts(" + contactId + ")";
|
||||
queryUrl = queryUrl + hashAPIPath(queryUrl);
|
||||
var config = {
|
||||
method: "patch",
|
||||
url: queryUrl + hashAPIPath(queryUrl),
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Content-Type": "application/json",
|
||||
"Authorization": getToken(),
|
||||
},
|
||||
url: queryUrl,
|
||||
data: data,
|
||||
};
|
||||
// console.log(config);
|
||||
|
||||
Reference in New Issue
Block a user