📜  通过更改在服务器上设置图像 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:20.508000             🧑  作者: Mango

代码示例1
public static async setAvatar(avatar: ImageFile) {
    const userData = await AuthService.getUserData();

    return this.handleRequestData(
      this.post(
        `${ApiUrls.setAvatarImage}/${userData?.id}`,
        this.objectToFormData({
          user_id: userData?.id,
          avatar_url: getFileObjectForImage(avatar),
        }),
        { headers: FORM_DATA_HEADER },
      ),
    );
  }