Skip to content

Commit

Permalink
Update creg.js
Browse files Browse the repository at this point in the history
  • Loading branch information
kailasnadh790 committed Jun 5, 2024
1 parent 0c6df17 commit aff18eb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/apis/creg/creg.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
// TODO: Use Sidekick Plugin for this
import { getMetadata } from '../../aem.js';

const CREG_PROPERY_SAVE_API_URL = '/bin/bhhs/cregPropertySaveServlet';

/**
* @typedef {Object} SearchResults
* @property {Array<Object>} properties
Expand Down Expand Up @@ -70,7 +72,7 @@ export function getSavedProperties(contactKey) {
return new Promise((resolve) => {
// get current timestamp
const timestamp = Date.now();
const url = `${CREG_API_URL}/cregPropertySaveServlet?ContactKey=${contactKey}&_=${timestamp}`;
const url = `${CREG_PROPERY_SAVE_API_URL}?ContactKey=${contactKey}&_=${timestamp}`;
fetch(url).then(async (resp) => {
if (resp.ok) {
resolve(await resp.json());
Expand All @@ -89,7 +91,7 @@ export function getSavedProperties(contactKey) {
*/
export function removeSavedProperty(contactKey, propertyId) {
return new Promise((resolve) => {
const url = `${CREG_API_URL}/cregPropertySaveServlet?notificationId=${propertyId}&ContactKey=${contactKey}`;
const url = `${CREG_PROPERY_SAVE_API_URL}?notificationId=${propertyId}&ContactKey=${contactKey}`;
fetch(url, {
method: 'DELETE',
}).then(async (resp) => {
Expand All @@ -115,7 +117,7 @@ export function saveProperty(property) {
Object.keys(property).forEach((key) => {
formData.append(key, encodeURIComponent(property[key]));
});
const url = `${CREG_API_URL}/cregPropertySaveServlet`;
const url = `${CREG_PROPERY_SAVE_API_URL}`;
fetch(url, {
method: 'POST',
headers: {
Expand Down

0 comments on commit aff18eb

Please sign in to comment.