1
2
3
4
5
6
7
8
9
10
11
12
13
14
const fetchUser = async (id) => {
const res = await fetch(`/api/users/${id}`);
if (!res.ok) {
throw new Error("User not found");
}
const data = await res.json();
return {
name: data.name,
email: data.email,
role: data.permissions.role,
};
};