fix: remove /languparent path prefix and align auth/feed flow with API

- Remove /languparent prefix from all API calls (routes are at /auth/* now)
- Align register/login token handling (JWT returned directly, no registration token)
- Feed rewritten to use new getFeedPairs endpoint with PairSentenceCard/YesNoCard/WordCard
- App.jsx: check language_native_id / language_target_id for profile completeness
- Profil.jsx: add logout button

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 15:04:20 +02:00
parent f86f42526f
commit 025b677257
7 changed files with 118 additions and 394 deletions

View File

@@ -3,6 +3,28 @@ import './Profil.css'
import { useAuth } from '../context/AuthContext'
import { getProfilData, getActiveLearningPair, getLanguageOptions, langById } from '../api/directus'
function LogoutButton() {
const { logout } = useAuth()
return (
<button onClick={logout} title="Abmelden" style={{
position: 'absolute', top: '20px', right: '4px',
background: 'none', border: 'none', cursor: 'pointer',
padding: '6px', borderRadius: '8px', color: '#9A8878',
display: 'flex', alignItems: 'center', justifyContent: 'center',
transition: 'color 0.15s, background 0.15s',
}}
onMouseEnter={e => { e.currentTarget.style.color = '#C0544A'; e.currentTarget.style.background = '#FBF0EF' }}
onMouseLeave={e => { e.currentTarget.style.color = '#9A8878'; e.currentTarget.style.background = 'none' }}
>
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"/>
<polyline points="16 17 21 12 16 7"/>
<line x1="21" y1="12" x2="9" y2="12"/>
</svg>
</button>
)
}
const SKILLS = [
{ label: 'Vokabular', value: 0.78 },
{ label: 'Grammatik', value: 0.65 },
@@ -124,7 +146,8 @@ export default function Profil() {
const streak = profil?.streak_days ?? 0
return (
<div className="profil">
<div className="profil" style={{ position: 'relative' }}>
<LogoutButton />
{/* ── Header ── */}
<div className="profil-header">
<div className="avatar-wrap">