0761bbd8c1
LST-68 (2.6) front. Completes the Integration module and Phase 2. - New frontend/modules/integration/ layer (auto-detected): services (gitea, bookstack, zimbra, share, share-settings) + their DTOs, and the useShareStatus composable. - Consumers repointed to ~/modules/integration/...: admin tabs (Gitea/BookStack/Zimbra/Share), PM task sections (TaskGitSection, TaskBookStackLinks, TaskDocumentShareLinker), ProjectDrawer, TaskModal, pages/documents.vue, components/share/SharedFilePreview.vue. - Admin tabs, SharedFilePreview and documents/admin pages stay at their location (only imports updated). i18n stays global. nuxt build passes; all routes preserved.
27 lines
1003 B
TypeScript
27 lines
1003 B
TypeScript
import type { ShareBrowseResult, ShareSearchResult, ShareStatus } from './dto/share'
|
|
|
|
export function useShareService() {
|
|
const api = useApi()
|
|
const config = useRuntimeConfig()
|
|
|
|
async function browse(path: string): Promise<ShareBrowseResult> {
|
|
const query = path ? `?path=${encodeURIComponent(path)}` : ''
|
|
return api.get<ShareBrowseResult>(`/share/browse${query}`)
|
|
}
|
|
|
|
async function search(query: string): Promise<ShareSearchResult> {
|
|
return api.get<ShareSearchResult>(`/share/search?q=${encodeURIComponent(query)}`)
|
|
}
|
|
|
|
async function getStatus(): Promise<ShareStatus> {
|
|
return api.get<ShareStatus>('/share/status')
|
|
}
|
|
|
|
function getDownloadUrl(path: string, disposition: 'inline' | 'attachment' = 'inline'): string {
|
|
const base = config.public.apiBase || '/api'
|
|
return `${base}/share/download?path=${encodeURIComponent(path)}&disposition=${disposition}`
|
|
}
|
|
|
|
return { browse, search, getStatus, getDownloadUrl }
|
|
}
|