Sorted out a bunch of reactivity issues

This commit is contained in:
2024-05-29 10:00:48 -04:00
parent 6654132120
commit 387af2e6ce
10 changed files with 304 additions and 228 deletions

View File

@@ -47,6 +47,19 @@ export const useReservationStore = defineStore('reservation', () => {
setDateLoaded(startDate, endDate, 'error');
}
};
const getReservationById = async (id: string) => {
try {
const response = await databases.getDocument(
AppwriteIds.databaseId,
AppwriteIds.collection.reservation,
id
);
return response as Reservation;
} catch (error) {
console.error('Failed to fetch reservation: ', error);
}
};
const createReservation = async (reservation: Reservation) => {
try {
const response = await databases.createDocument(
@@ -75,7 +88,6 @@ export const useReservationStore = defineStore('reservation', () => {
return false;
}
console.log(id);
try {
await databases.deleteDocument(
AppwriteIds.databaseId,
@@ -203,6 +215,7 @@ export const useReservationStore = defineStore('reservation', () => {
return {
getReservationsByDate,
getReservationById,
createReservation,
deleteReservation,
fetchReservationsForDateRange,