Template
16 lines
449 B
TypeScript
16 lines
449 B
TypeScript
import { UserResponseDTO } from "~/netcode/events/dto/userresponse.dto";
|
|
|
|
export async function fetchUser(id: string) {
|
|
const config = useRuntimeConfig();
|
|
const data = await useFetch<UserResponseDTO>(config.public.endpoint + `/users/` + id, {
|
|
credentials: "include",
|
|
}).then(_d => {
|
|
if (_d.data.value) {
|
|
_d.data.value = new UserResponseDTO(_d.data.value)
|
|
}
|
|
return _d
|
|
})
|
|
|
|
return data
|
|
}
|