fix: use correct token key for profile API and add CPF to profile view
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 50s Details

This commit is contained in:
Sidney Gomes 2026-07-21 20:25:25 -03:00
parent 1ab4326778
commit 844796e404
1 changed files with 12 additions and 2 deletions

View File

@ -41,7 +41,7 @@ export default function ProfileView({ user, onBack, onUpdateUser }: ProfileViewP
const handleSave = async () => {
setIsSaving(true);
try {
const token = localStorage.getItem('token');
const token = localStorage.getItem('devflix_token');
const res = await fetch('/api/users/profile', {
method: 'PUT',
headers: {
@ -73,7 +73,7 @@ export default function ProfileView({ user, onBack, onUpdateUser }: ProfileViewP
formData.append('avatar', file);
try {
const token = localStorage.getItem('token');
const token = localStorage.getItem('devflix_token');
const res = await fetch('/api/users/avatar', {
method: 'POST',
headers: {
@ -250,6 +250,16 @@ export default function ProfileView({ user, onBack, onUpdateUser }: ProfileViewP
{user.createdAt ? new Date(user.createdAt).toLocaleDateString('pt-BR') : 'Não disponível'}
</p>
</div>
<div className="bg-black/30 p-4 rounded-xl border border-white/5 flex flex-col justify-center md:col-span-2">
<div className="flex items-center space-x-3 mb-1">
<Shield className="w-4 h-4 text-zinc-500" />
<p className="text-[10px] uppercase font-bold text-zinc-500">CPF</p>
</div>
<p className="text-sm font-medium text-white opacity-60 cursor-not-allowed pl-7">
{user.cpf ? user.cpf.replace(/(\d{3})(\d{3})(\d{3})(\d{2})/, "$1.$2.$3-$4") : 'Não informado'}
</p>
</div>
</div>
{user.role === 'admin' && (