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
Build and Deploy (Gitea) / build-and-deploy (push) Successful in 50s
Details
This commit is contained in:
parent
1ab4326778
commit
844796e404
|
|
@ -41,7 +41,7 @@ export default function ProfileView({ user, onBack, onUpdateUser }: ProfileViewP
|
||||||
const handleSave = async () => {
|
const handleSave = async () => {
|
||||||
setIsSaving(true);
|
setIsSaving(true);
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem('token');
|
const token = localStorage.getItem('devflix_token');
|
||||||
const res = await fetch('/api/users/profile', {
|
const res = await fetch('/api/users/profile', {
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
headers: {
|
headers: {
|
||||||
|
|
@ -73,7 +73,7 @@ export default function ProfileView({ user, onBack, onUpdateUser }: ProfileViewP
|
||||||
formData.append('avatar', file);
|
formData.append('avatar', file);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const token = localStorage.getItem('token');
|
const token = localStorage.getItem('devflix_token');
|
||||||
const res = await fetch('/api/users/avatar', {
|
const res = await fetch('/api/users/avatar', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
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'}
|
{user.createdAt ? new Date(user.createdAt).toLocaleDateString('pt-BR') : 'Não disponível'}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</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>
|
</div>
|
||||||
|
|
||||||
{user.role === 'admin' && (
|
{user.role === 'admin' && (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue