updated query to remove ldp and misc types

This commit is contained in:
2021-10-28 16:59:51 +01:00
parent 610a7cb15d
commit 691421052c
8 changed files with 195 additions and 84 deletions
+75 -10
View File
@@ -617,7 +617,7 @@ export const getAppealsTypes = (token) => {
return axios
.get(
WEBAPI_URL +
"stringmaps?$filter=attributename%20eq%20%27pinswg_appealcasetype%27&$count=true&$select=value,stringmapid,organizationid,attributevalue",
"stringmaps?$filter=attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue",
azureHeaders(token)
)
.then((res) => res.data)
@@ -642,7 +642,7 @@ export const getLPA = (token) => {
azureHeaders(token)
)
.then((res) => {
console.log(res.data);
//console.log(res.data);
return res.data;
})
.catch((error) => {
@@ -656,18 +656,28 @@ export const getLPA = (token) => {
});
};
export const getPersonalAccount = () => {
console.log("api_root: ", BASE_URL);
export const getPersonalAccount = (token, contactid) => {
console.log("getting personal details:", contactid);
return axios
.get(
BASE_URL + "/api/lookups/personaldetails",
//.get("https://devcrm2016.llcdt.gov.wales/DVPINS/api/data/v8.2/contacts?$select=name",
{ httpsAgent: new https.Agent({ rejectUnauthorized: false }) }
WEBAPI_URL +
"contacts(" +
contactid +
")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true",
azureHeaders(token)
)
.then((res) => res.data)
.then((res) => {
console.log(res.data);
return res.data;
})
.catch((error) => {
console.log("thi serror", error);
let ErrResponse = {
value: [],
errorCode: error.response.status,
errorMsg: error.response.statusText,
};
return ErrResponse;
});
};
@@ -916,3 +926,58 @@ export const createAccount = (formValues) => {
console.log("this serror", error);
});
};
export const updateAccount = (contactId, updateBody) => {
var data = JSON.stringify(updateBody);
var config = {
method: "patch",
url: "/api/proxy/contacts(" + contactId + ")",
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation',
"Content-Type": "application/json",
"ServiceBusAuthorization": getSASToken(),
},
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);
});
};
export const updatePassword = (contactId, newpassword) => {
let updateBody = { "pinswg_custom_password": newpassword };
var data = JSON.stringify(updateBody);
var config = {
method: "patch",
url: "/api/proxy/contacts(" + contactId + ")",
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation',
"Content-Type": "application/json",
"ServiceBusAuthorization": getSASToken(),
},
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);
});
};