([]);
+ const { updateSelectedTagId } = useTagTreeState();
+
+ const router = useRouter();
+
+ useEffect(() => {
+ updateTag();
+ }, []);
+
+ const updateTag = async () => {
+ const response = await fetch(`/api/tags/root`, {
+ method: "GET",
+ headers: { "Content-Type": "application/json" },
+ });
+
+ if (!response.ok) {
+ return;
+ }
+
+ const data: Tag[] = await response.json();
+ setRootTags(data);
+ };
+
+ const onChildClick = (id: number) => {
+ updateSelectedTagId(id);
+ router.push(`/explorer/${id}`);
+ };
+
+ return (
+
+ {rootTags.map((c, i) => (
+ }
+ onClick={() => onChildClick(c.id)}
+ >
+ {c.name}
+
+ ))}
+
+ );
+}