Added Dokubox Sync Service and Button Fix #12
This commit is contained in:
@@ -11,6 +11,7 @@ const router = useRouter()
|
||||
const route = useRoute()
|
||||
const modal = useModal()
|
||||
const toast = useToast()
|
||||
const { $api } = useNuxtApp()
|
||||
const files = useFiles()
|
||||
|
||||
// --- State ---
|
||||
@@ -222,11 +223,50 @@ defineShortcuts({
|
||||
'arrowdown': () => { if (selectedFileIndex.value < renderedFileList.value.length - 1) selectedFileIndex.value++ },
|
||||
'arrowup': () => { if (selectedFileIndex.value > 0) selectedFileIndex.value-- }
|
||||
})
|
||||
|
||||
const isSyncing = ref(false)
|
||||
|
||||
const syncdokubox = async () => {
|
||||
isSyncing.value = true
|
||||
try {
|
||||
await $api('/api/functions/services/syncdokubox', { method: 'POST' })
|
||||
|
||||
toast.add({
|
||||
title: 'Erfolg',
|
||||
description: 'Dokubox wurde synchronisiert.',
|
||||
icon: 'i-heroicons-check-circle',
|
||||
color: 'green'
|
||||
})
|
||||
|
||||
// Liste neu laden
|
||||
await setupPage()
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
toast.add({
|
||||
title: 'Fehler',
|
||||
description: 'Beim Synchronisieren der Dokubox ist ein Fehler aufgetreten.',
|
||||
icon: 'i-heroicons-exclamation-circle',
|
||||
color: 'red'
|
||||
})
|
||||
} finally {
|
||||
isSyncing.value = false
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UDashboardNavbar title="Dateien">
|
||||
<template #right>
|
||||
<UButton
|
||||
label="Dokubox Sync"
|
||||
icon="i-heroicons-sparkles"
|
||||
color="primary"
|
||||
variant="solid"
|
||||
:loading="isSyncing"
|
||||
@click="syncdokubox"
|
||||
class="mr-2"
|
||||
/>
|
||||
<UInput id="searchinput" v-model="searchString" icon="i-heroicons-magnifying-glass" placeholder="Suche..." class="w-64" />
|
||||
</template>
|
||||
</UDashboardNavbar>
|
||||
|
||||
Reference in New Issue
Block a user