fix: allow testing claim mapping rules before saving and keep rows editable after test
The test endpoint now accepts inline rules from the client instead of reading from the database, so unsaved rules can be tested. Matched rows show the checkmark alongside action buttons instead of replacing them. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -90,12 +90,22 @@ export function useDeleteClaimMappingRule() {
|
||||
});
|
||||
}
|
||||
|
||||
export interface TestRuleInput {
|
||||
id: string;
|
||||
claim: string;
|
||||
matchType: string;
|
||||
matchValue: string;
|
||||
action: string;
|
||||
target: string;
|
||||
priority: number;
|
||||
}
|
||||
|
||||
export function useTestClaimMappingRules() {
|
||||
return useMutation({
|
||||
mutationFn: (claims: Record<string, unknown>) =>
|
||||
mutationFn: ({ rules, claims }: { rules: TestRuleInput[]; claims: Record<string, unknown> }) =>
|
||||
adminFetch<TestResponse>('/claim-mappings/test', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(claims),
|
||||
body: JSON.stringify({ rules, claims }),
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user