Skip to content

Commit

Permalink
feat: update to new onemap api
Browse files Browse the repository at this point in the history
  • Loading branch information
joycesin committed Feb 20, 2024
1 parent 5480880 commit 978af70
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Components/Driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ export class Driver extends React.Component {

callPostal = (postal) => {
return fetch(
"https://developers.onemap.sg/commonapi/search?searchVal=" +
"https://www.onemap.gov.sg/api/common/elastic/search?searchVal=" +
postal +
"&returnGeom=Y&getAddrDetails=Y"
)
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Info.js
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ export class Info extends React.Component {

callPostal = (postal) => {
return fetch(
"https://developers.onemap.sg/commonapi/search?searchVal=" +
"https://www.onemap.gov.sg/api/common/elastic/search?searchVal=" +
postal +
"&returnGeom=Y&getAddrDetails=Y"
)
Expand Down
4 changes: 2 additions & 2 deletions src/Components/ListForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const createDomain = async (name, id, cover, uid) => {
docid: id,
logo: "",
cover: cover,
delivery_option: "none"
delivery_option: "none",
})
.then(async () => {
await db
Expand Down Expand Up @@ -474,7 +474,7 @@ export class ListForm extends React.Component {

callPostal = (postal) => {
return fetch(
"https://developers.onemap.sg/commonapi/search?searchVal=" +
"https://www.onemap.gov.sg/api/common/elastic/search?searchVal=" +
postal +
"&returnGeom=Y&getAddrDetails=Y"
)
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ export class Page extends React.Component {

callPostal = (postal) => {
return fetch(
"https://developers.onemap.sg/commonapi/search?searchVal=" +
"https://www.onemap.gov.sg/api/common/elastic/search?searchVal=" +
postal +
"&returnGeom=Y&getAddrDetails=Y"
)
Expand Down
21 changes: 13 additions & 8 deletions src/Components/PageConfirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class FullScreenDialog extends Component {

callPostal = (postal) => {
return fetch(
"https://developers.onemap.sg/commonapi/search?searchVal=" +
"https://www.onemap.gov.sg/api/common/elastic/search?searchVal=" +
postal +
"&returnGeom=Y&getAddrDetails=Y"
)
Expand Down Expand Up @@ -344,7 +344,8 @@ class FullScreenDialog extends Component {
this.context.cartProducts.length !== 0 &&
this.context.cartProducts[i].quantity !== 0
) {
number_of_items = number_of_items + this.context.cartProducts[i].quantity;
number_of_items =
number_of_items + this.context.cartProducts[i].quantity;
let addons = "";
let addonValue = 0;

Expand Down Expand Up @@ -518,11 +519,15 @@ class FullScreenDialog extends Component {
this.context.cartProducts.length !== 0 &&
this.context.cartProducts[i].quantity !== 0
) {
var addonsArray = []
this.context.cartProducts[i].addons.forEach(index => {
var itemName = this.context.pageData.menu_combined[this.context.cartProducts[i].index].addon[index].name
var itemPrice = this.context.pageData.menu_combined[this.context.cartProducts[i].index].addon[index].price
addonsArray.push(itemName + " (+$" +itemPrice + ")")
var addonsArray = [];
this.context.cartProducts[i].addons.forEach((index) => {
var itemName = this.context.pageData.menu_combined[
this.context.cartProducts[i].index
].addon[index].name;
var itemPrice = this.context.pageData.menu_combined[
this.context.cartProducts[i].index
].addon[index].price;
addonsArray.push(itemName + " (+$" + itemPrice + ")");
});
orderItems.push({
name: this.context.pageData.menu_combined[
Expand All @@ -535,7 +540,7 @@ class FullScreenDialog extends Component {
this.context.cartProducts[i].index
].price
).toFixed(2),
addon: addonsArray
addon: addonsArray,
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class Search extends React.Component {
callPostal = async () => {
try {
const response = await fetch(
"https://developers.onemap.sg/commonapi/search?searchVal=" +
"https://www.onemap.gov.sg/api/common/elastic/search?searchVal=" +
this.state.postal +
"&returnGeom=Y&getAddrDetails=Y"
);
Expand Down
2 changes: 1 addition & 1 deletion src/Helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ async function sendEmailToUpdateListing(

async function getLatLng(postal) {
return fetch(
"https://developers.onemap.sg/commonapi/search?searchVal=" +
"https://www.onemap.gov.sg/api/common/elastic/search?searchVal=" +
postal +
"&returnGeom=Y&getAddrDetails=Y"
)
Expand Down

0 comments on commit 978af70

Please sign in to comment.