blob: 86dfce872346d5bc39daf925002654bd95dbbd2a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
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();
}
|