// src/api/auth/register.ts
import instance from "../axiosInstance"

export async function register(username: string, email: string, password: string) {
  try {
    const { data } = await instance.post("/auth/register", {
      username,
      email,
      password,
    })
    return data // { token, user }
  } catch (error: any) {
    const message = error.response?.data?.message || "Kayıt başarısız"
    console.error("Register hatası:", message)
    throw new Error(message)
  }
}
