1const res = await fetch(`${process.env.NEXT_PUBLIC_API}/users/${id}`, {
2 headers: {
3 "Content-Type": "application/json",
4 Authorization: `Bearer ${token}`,
5 },
6 signal: controller.signal,
7})
8if (!res.ok) {
9 const body = await res.text()
10 throw new Error(`${res.status}: ${body}`)
11}
12const user = (await res.json()) as User
13
14export async function GET(req: Request) {
15
16
17}
18
19export const userKeys = { byId: (id) => ["users", id] }
20const { data } = useQuery({ queryKey: userKeys.byId(id), queryFn })
const user = await caller.users.getById({ id })
const { data } = q.users.useQuery("getById", { variables: { id } })