Files
Central/frontend/services/auth.ts
matthieu 8e59f59679 feat : init Central project — Symfony 8 + Nuxt 4 + Docker starter
Same architecture as Lesstime: API Platform 4, JWT auth, @malio/layer-ui,
PostgreSQL 16, Docker Compose (ports 8083/3003/5436), dark mode theme.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 10:14:39 +02:00

23 lines
610 B
TypeScript

import type { UserData } from './dto/user-data'
export function getCurrentUser() {
const api = useApi()
return api.get<UserData>('/me', {}, { toastErrorKey: 'errors.auth.session' })
}
export function login(username: string, password: string) {
const api = useApi()
return api.post('/login_check', { username, password }, {
toastOn401: true,
toastErrorKey: 'errors.auth.login'
})
}
export function logout() {
const api = useApi()
return api.post('/logout', {}, {
toastErrorKey: 'errors.auth.logout',
toastSuccessKey: 'success.auth.logout'
})
}