mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-06 16:31:12 +08:00
feat: implement backend API for installing hook templates in HookManager and HookWizard components
This commit is contained in:
@@ -268,12 +268,25 @@ export function HookManagerPage() {
|
||||
|
||||
setInstallingTemplateId(templateId);
|
||||
try {
|
||||
await installHookTemplate(template.trigger, {
|
||||
id: template.id,
|
||||
command: template.command,
|
||||
args: template.args ? [...template.args] : undefined,
|
||||
matcher: template.matcher,
|
||||
// Use backend API to install template
|
||||
const response = await fetch('/api/hooks/templates/install', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
templateId,
|
||||
scope: 'project',
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to install template: ${response.statusText}`);
|
||||
}
|
||||
|
||||
const result = await response.json();
|
||||
if (!result.success) {
|
||||
throw new Error(result.error || 'Unknown error');
|
||||
}
|
||||
|
||||
await refetch();
|
||||
} catch (error) {
|
||||
console.error('Failed to install template:', error);
|
||||
|
||||
Reference in New Issue
Block a user