Sorted out a bunch of reactivity issues
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user