const API_URL = process.env.NEXT_PUBLIC_API_URL; export async function getUserByUsername(username: string) { if (!username) throw new Error('Username is required'); const res = await fetch(`${API_URL}/api/users/${username}`, { cache: 'no-store', }); if (!res.ok) throw new Error(`User not found: ${username}`); return res.json(); }