Follow-up to a7609ff for the whole frontend: all 30 API helpers in
src/lib now pass path values through encodeURIComponent, so an id taken
from the URL can never leave its own path segment and make the page call
another endpoint with the viewer's token.
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
23 lines
721 B
TypeScript
23 lines
721 B
TypeScript
import { apiFetch } from "@/lib/auth/api-client";
|
|
import { AutomationRule, UpdateAutomationRuleInput } from "./types";
|
|
|
|
export function fetchAutomationRules(): Promise<AutomationRule[]> {
|
|
return apiFetch<AutomationRule[]>("/automation-rules");
|
|
}
|
|
|
|
export function updateAutomationRule(
|
|
id: string,
|
|
input: UpdateAutomationRuleInput,
|
|
): Promise<AutomationRule> {
|
|
return apiFetch<AutomationRule>(`/automation-rules/${encodeURIComponent(id)}`, {
|
|
method: "PATCH",
|
|
body: JSON.stringify(input),
|
|
});
|
|
}
|
|
|
|
export function resetAutomationRuleSequence(id: string): Promise<AutomationRule> {
|
|
return apiFetch<AutomationRule>(`/automation-rules/${encodeURIComponent(id)}/reset-sequence`, {
|
|
method: "POST",
|
|
});
|
|
}
|