feat: Enhance reservation functionality
This commit is contained in:
@@ -161,7 +161,7 @@ import {
|
||||
IonPage, IonHeader, IonToolbar, IonTitle, IonContent, IonButtons,
|
||||
IonMenuButton, IonButton, IonIcon, IonCard, IonCardContent, IonBadge,
|
||||
IonList, IonItem, IonLabel, IonInput, IonTextarea, IonSelect, IonSelectOption,
|
||||
IonSpinner, IonModal, IonAlert, IonToast,
|
||||
IonSpinner, IonModal, IonAlert, IonToast, onIonViewWillEnter,
|
||||
} from '@ionic/vue'
|
||||
import { addOutline, pencilOutline, trashOutline } from 'ionicons/icons'
|
||||
import type { Database } from '~/types/supabase'
|
||||
@@ -215,12 +215,16 @@ const filteredReservations = computed(() => {
|
||||
})
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
async function loadAll() {
|
||||
await Promise.all([fetchBoats(), fetchMembers()])
|
||||
await fetchReservations()
|
||||
})
|
||||
}
|
||||
|
||||
watch([filterDateFrom, filterDateTo], fetchReservations)
|
||||
const user = useSupabaseUser()
|
||||
watch(user, (val) => { if (val) loadAll() }, { immediate: true })
|
||||
onIonViewWillEnter(() => { if (user.value) loadAll() })
|
||||
|
||||
watch([filterDateFrom, filterDateTo], () => { if (user.value) fetchReservations() })
|
||||
|
||||
async function fetchBoats() {
|
||||
const { data } = await supabase.from('boats').select('*').order('name')
|
||||
|
||||
Reference in New Issue
Block a user