feat: support settings

This commit is contained in:
Henry Li
2026-01-20 23:43:21 +08:00
parent 7ead7c93f8
commit 1b70e00642
25 changed files with 1355 additions and 217 deletions
+25
View File
@@ -0,0 +1,25 @@
import { env } from "@/env";
import type { Skill } from "./type";
export async function loadSkills() {
const skills = await fetch(`${env.NEXT_PUBLIC_BACKEND_BASE_URL}/api/skills`);
const json = await skills.json();
return json.skills as Skill[];
}
export async function enableSkill(skillName: string, enabled: boolean) {
const response = await fetch(
`${env.NEXT_PUBLIC_BACKEND_BASE_URL}/api/skills/${skillName}`,
{
method: "PUT",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
enabled,
}),
},
);
return response.json();
}