Skip to content

Commit 9f9d93b

Browse files
authored
Merge pull request #52 from untilhamza:release/v1.10.0
Release/v1.10.0
2 parents a0cdcc6 + 550930c commit 9f9d93b

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/hooks/request.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ async function httpCheckBooking(phoneNumber) {
175175
}
176176
}
177177

178-
179178
//load bookings for given date as json
180179
async function httpGetBookings(dateMoment) {
181180
try {
@@ -284,13 +283,15 @@ async function httpSubmitBooking(bookingData) {
284283
status: "confirmed",
285284
};
286285

287-
await uploadSlot(slot);
286+
//alert(JSON.stringify({ ...bookingData, ...slot }));
288287

289288
const response = await addDoc(bookingsCollectionRef, {
290289
...bookingData,
291290
...slot,
292291
});
293292

293+
await uploadSlot(slot);
294+
294295
//pull out the id that was returned here...
295296
return response.id;
296297
} else {
@@ -324,18 +325,23 @@ async function httpCancelBooking(id) {
324325
//get reference to booking to be deleted
325326
const bookingDocRef = doc(db, "bookings", id);
326327

328+
let bookingSnap = await getDoc(bookingDocRef);
329+
330+
let firebaseTimeStamp = bookingSnap.data().date;
331+
await deleteRemoteSlot(firebaseTimeStamp, "confirmed");
332+
327333
//will update the status field on the booking to being updated...
328334
const newFields = { status: "cancelled" };
329335

330336
//mark booking as deleted in database
331337
await updateDoc(bookingDocRef, newFields);
332338

333-
let bookingSnap = await getDoc(bookingDocRef);
339+
bookingSnap = await getDoc(bookingDocRef);
334340

335341
if (bookingSnap.exists()) {
336342
//delete slot for this booking from blocked and confirmed slot collection
337-
let firebaseTimeStamp = bookingSnap.data().date;
338-
await deleteRemoteSlot(firebaseTimeStamp, "confirmed");
343+
// let firebaseTimeStamp = bookingSnap.data().date;
344+
// await deleteRemoteSlot(firebaseTimeStamp, "confirmed");
339345
} else {
340346
//TODO: stop transaction....
341347
throw new Error("The booking you are attempting to cancel was not found!");

src/version.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "1.9.0"
2+
"version": "1.10.0"
33
}

0 commit comments

Comments
 (0)