hezarfen_frontend
Clone
https://git.tahinli.com/Hezarfen/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | // The avatar endpoint answers with raw image bytes, so it is read through a |
| 2 | // plain <img src>, not fetch: /api is same-origin, which carries the session |
| 3 | // cookie on its own. `version` is a cache-buster the caller bumps after an |
| 4 | // upload or delete — the URL is otherwise identical before and after, and the |
| 5 | // browser's in-memory image cache would keep serving the old bytes. |
| 6 | export function getUserAvatarUrl(userId: string, version?: number): string { |
| 7 | const bust = version ? `?v=${version}` : ""; |
| 8 | return `/api/users/${encodeURIComponent(userId)}/avatar${bust}`; |
| 9 | } |