import httpClient from "@/shared/config/api/httpClient";
import { UPDATE_USERS } from "@/shared/config/api/URLs";

export const Auth_Api = {
  async updateUser({
    first_name,
    last_name,
    avatar,
  }: {
    first_name: string;
    last_name: string;
    avatar?: File;
  }) {
    const formData = new FormData();
    formData.append("first_name", first_name);
    formData.append("last_name", last_name);
    if (avatar) {
      formData.append("avatar", avatar);
    }

    const res = await httpClient.patch(UPDATE_USERS, formData, {
      headers: {
        "Content-Type": "multipart/form-data",
      },
    });
    return res;
  },
};
