refactor, security updates, cv extraction upgrades

This commit is contained in:
2026-04-11 01:34:32 +02:00
parent 806b200ac5
commit 27fd70a2d7
59 changed files with 6817 additions and 1561 deletions
@@ -3,7 +3,7 @@ import React, { useEffect, useMemo, useState } from "react";
import { Box, Button, Paper, Typography } from "@mui/material";
import { api } from "../api";
import { clearAuthToken, getAuthToken } from "../auth";
import { clearAuthClientState } from "../auth";
import { useToast } from "../toast";
import { useI18n } from "../i18n/I18nProvider";
@@ -25,19 +25,20 @@ type MeResponse = {
export default function AuthStatusCard() {
const { toast } = useToast();
const { t } = useI18n();
const token = getAuthToken();
const [me, setMe] = useState<MeResponse | null>(null);
useEffect(() => {
if (!token) {
setMe(null);
return;
}
api
.get<MeResponse>("/auth/me")
.then((r) => setMe(r.data))
.catch(() => setMe(null));
}, [token]);
const refresh = () => {
api
.get<MeResponse>("/auth/me")
.then((r) => setMe(r.data))
.catch(() => setMe(null));
};
refresh();
window.addEventListener("auth-changed", refresh);
return () => window.removeEventListener("auth-changed", refresh);
}, []);
const label = useMemo(() => me?.userName || me?.displayName || [me?.firstName, me?.lastName].filter(Boolean).join(" ") || me?.email, [me]);
@@ -47,7 +48,7 @@ export default function AuthStatusCard() {
{t("authStatusTitle")}
</Typography>
{!token ? (
{!me ? (
<Typography sx={{ color: "text.secondary" }}>{t("authStatusNotSignedIn")}</Typography>
) : (
<Box sx={{ display: "flex", flexDirection: "column", gap: 0.5 }}>
@@ -69,9 +70,11 @@ export default function AuthStatusCard() {
<Button
variant="outlined"
onClick={() => {
clearAuthToken();
setMe(null);
toast(t("signedOut"), "info");
void api.post("/auth/logout").catch(() => undefined).finally(() => {
setMe(null);
clearAuthClientState();
toast(t("signedOut"), "info");
});
}}
>
{t("signOut")}