adding API_BASE url to avatar URL to fetch it properly

This commit is contained in:
2025-11-14 23:45:10 +05:30
parent bd8aea46b1
commit 4e2af82573
2 changed files with 12 additions and 2 deletions

View File

@@ -30,7 +30,12 @@ export function ArticleMeta({
<Avatar
key={index}
alt={author.name}
src={author.avatar}
src={
(import.meta.env.VITE_API_BASE_URL.replace(/\/+$/, "") +
"/" +
(author.avatar?.replace(/^\/+/, "") || "")
)
}
sx={{ width: 24, height: 24 }}
/>
))}

View File

@@ -122,7 +122,12 @@ export default function Profile({ onBack }: ProfileProps) {
<Box sx={{ display: 'flex', alignItems: 'center', gap: 2, mb: 3 }}>
<Avatar
src={formData.avatar}
src={
(import.meta.env.VITE_API_BASE_URL.replace(/\/+$/, "") +
"/" +
(formData.avatar?.replace(/^\/+/, "") || "")
)
}
alt={formData.name || formData.username}
sx={{ width: 64, height: 64 }}
/>