Supabase Removals Frontend
This commit is contained in:
@@ -1,10 +1,20 @@
|
||||
<script setup>
|
||||
const supabase = useSupabaseClient()
|
||||
const profileStore = useProfileStore()
|
||||
|
||||
const workingtimes = ref([])
|
||||
const setupPage = async () => {
|
||||
workingtimes.value = (await supabase.from("workingtimes").select().eq("tenant",profileStore.currentTenant).is("endDate",null)).data
|
||||
const profiles = profileStore.profiles || []
|
||||
const checks = await Promise.all(profiles.map(async (profile) => {
|
||||
try {
|
||||
const spans = await useNuxtApp().$api(`/api/staff/time/spans?targetUserId=${profile.user_id || profile.id}`)
|
||||
const openSpan = (spans || []).find((s) => !s.endedAt && s.type === "work")
|
||||
if (openSpan) return { profile: profile.id }
|
||||
} catch (e) {
|
||||
return null
|
||||
}
|
||||
return null
|
||||
}))
|
||||
workingtimes.value = checks.filter(Boolean)
|
||||
}
|
||||
|
||||
setupPage()
|
||||
@@ -21,4 +31,4 @@ setupPage()
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user