import { usernameClient } from "better-auth/client/plugins";
import { createAuthClient } from "better-auth/vue";

const baseURL = import.meta.env.DEV ? window.location.origin : import.meta.env.VITE_API_URL;

export const authClient = createAuthClient({
  baseURL,
  fetchOptions: {
    credentials: "include",
    auth: {
      type: "Bearer",
      token: () => localStorage.getItem("user-token") || "",
    },
  },
  plugins: [usernameClient()],
});
