ce47fe5fdc
Skipper (nur Owner) und Crew (WRITE-Collaborators) können Logbuchseiten optional per WebAuthn freigeben; klassische Unterschrift bleibt als Fallback. Signatur ist an den Eintrags-Hash gebunden, Export in CSV/PDF angepasst. Co-authored-by: Cursor <cursoragent@cursor.com>
21 lines
524 B
TypeScript
21 lines
524 B
TypeScript
export interface LogbookAccess {
|
|
isOwner: boolean
|
|
role: 'OWNER' | 'READ' | 'WRITE'
|
|
writeCollaboratorCount: number
|
|
}
|
|
|
|
export async function getLogbookAccess(logbookId: string): Promise<LogbookAccess | null> {
|
|
const userId = localStorage.getItem('active_userid')
|
|
if (!userId || !navigator.onLine) return null
|
|
|
|
try {
|
|
const res = await fetch(`/api/logbooks/${logbookId}/access`, {
|
|
headers: { 'X-User-Id': userId }
|
|
})
|
|
if (!res.ok) return null
|
|
return res.json()
|
|
} catch {
|
|
return null
|
|
}
|
|
}
|