.
This commit is contained in:
@@ -1,10 +1,16 @@
|
||||
import axios from "../http-client"
|
||||
import type { RecipientChannel, User } from "../types"
|
||||
import type { FullUser, PartialUser, RecipientChannel, UserId, Uuid } from "../types"
|
||||
|
||||
export async function me() {
|
||||
const response = await axios.get("/users/@me")
|
||||
|
||||
return response.data as User
|
||||
return response.data as FullUser
|
||||
}
|
||||
|
||||
export async function getUser(userId: UserId) {
|
||||
const response = await axios.get(`/users/${userId}`)
|
||||
|
||||
return response.data as PartialUser
|
||||
}
|
||||
|
||||
export async function channels() {
|
||||
@@ -13,7 +19,20 @@ export async function channels() {
|
||||
return response.data as RecipientChannel[]
|
||||
}
|
||||
|
||||
interface PatchUserRequest {
|
||||
displayName?: string | null
|
||||
avatarId?: Uuid | null
|
||||
}
|
||||
|
||||
export async function patchUser(request: PatchUserRequest) {
|
||||
const response = await axios.patch(`/users/@me`, request)
|
||||
|
||||
return response.data as FullUser
|
||||
}
|
||||
|
||||
export default {
|
||||
me,
|
||||
channels
|
||||
channels,
|
||||
getUser,
|
||||
patchUser
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user