import { createApi } from "@reduxjs/toolkit/query/react";
import { baseQueryWithReauth } from "./apiSlice";

export const myProfile = createApi({
  reducerPath: "myProfile",
  baseQuery: baseQueryWithReauth, // Use enhanced baseQuery with error handling
  endpoints: (builder) => ({



    // getPosts: builder.query<Post[], void>({ query: () => "/profile-image-edit" }),

updateImage: builder.mutation({
  query: (formData: FormData) => {
    const token = localStorage.getItem("token");

    return {
      url: "/profile-image-edit",
      method: "POST",
      body: formData,
      headers: {
        "access-token": `${token}`,
      },
    };
  },
}),





  }),
});

export const {
  useUpdateImageMutation,
} = myProfile;
