import { Button } from "@heroui/react"
import { createFileRoute } from "@tanstack/react-router"
import { getUserPlaces, insertUserPlace } from "@/lib/server/places"

export const Route = createFileRoute("/places")({
	component: RouteComponent
})

function RouteComponent() {
  
	const submitUser = async () => {
		await insertUserPlace({
			data: {
				name: "Place 1",
				description: "A nice place",
				coord_x: "40.7128",
				coord_y: "-74.0060",
				id_user: "e6472b9d-01a9-4e2e-8bdc-0ddaa9baf5d8", // Replace with actual user ID
				hidden_place: false
			}
		})
	}

  const fetchPlaces = async () => {
    const places = await getUserPlaces();
    console.log(places);
  }

	return (
		<div>
			<Button onPress={fetchPlaces}>Click</Button>
		</div>
	)
}
