feat: add global event listener for mannschaften updates in Navigation component feat: notify app of mannschaften changes after CSV save and handle visibility changes refactor: remove unused anlagen page fix: update CmsMannschaften reference in sportbetrieb page for reactivity fix: enhance authentication token retrieval in passkey API endpoints feat: implement refresh session and access token generation for Android clients in passkey login fix: unify token retrieval method across passkey API endpoints feat: add MediaTypes utility for JSON content type in Android app feat: create PasskeyRepository for handling passkey authentication and registration in Android app feat: add validated text field and rich text components for Android UI feat: implement newsletter subscription and unsubscription screens in Android app feat: create public pages including Impressum with dynamic content loading
27 lines
785 B
JavaScript
27 lines
785 B
JavaScript
import { getUserFromToken } from '../../../utils/auth.js'
|
|
|
|
export default defineEventHandler(async (event) => {
|
|
const token = getCookie(event, 'auth_token') || getHeader(event, 'authorization')?.replace(/^Bearer\s+/i, '')
|
|
const user = token ? await getUserFromToken(token) : null
|
|
|
|
if (!user) {
|
|
throw createError({ statusCode: 401, statusMessage: 'Nicht authentifiziert' })
|
|
}
|
|
|
|
const passkeys = Array.isArray(user.passkeys) ? user.passkeys : []
|
|
|
|
return {
|
|
success: true,
|
|
passkeys: passkeys.map(pk => ({
|
|
id: pk.id,
|
|
name: pk.name || 'Passkey',
|
|
credentialId: pk.credentialId,
|
|
createdAt: pk.createdAt || null,
|
|
lastUsedAt: pk.lastUsedAt || null,
|
|
deviceType: pk.deviceType || null,
|
|
backedUp: pk.backedUp ?? null
|
|
}))
|
|
}
|
|
})
|
|
|