function setUserAvatar
setUserAvatar(
userId: string,
): Promise<User>

Makes the image data user userId's avatar and returns them, for an upload (PUT /api/me/avatar) and for the avatar a user from another instance has there (federation-service.ts). Presence alone would update only the online list, so it also sends user_updated, which reaches every avatar on screen, its bumped updatedAt busting their cache.

Parameters

userId: string

Return Type

Promise<User>

Throws

APIException

400 when data isn't an image an avatar may be, 404 when there is no such user.

Usage

import { setUserAvatar } from "api/services/user-service.ts";