fix: types in audit log wrapper (#6200)

This commit is contained in:
Piyush Gupta
2025-07-10 09:25:28 +05:30
committed by GitHub
parent 572b613034
commit 18ba5bbd8a
2 changed files with 8 additions and 5 deletions

View File

@@ -93,7 +93,10 @@ export const ResponseTagsWrapper: React.FC<ResponseTagsWrapperProps> = ({
return;
}
if (createTagResponse?.data?.error?.code === TagError.TAG_NAME_ALREADY_EXISTS) {
if (
createTagResponse?.data?.ok === false &&
createTagResponse?.data?.error?.code === TagError.TAG_NAME_ALREADY_EXISTS
) {
toast.error(t("environments.surveys.responses.tag_already_exists"), {
duration: 2000,
icon: <AlertCircleIcon className="h-5 w-5 text-orange-500" />,

View File

@@ -199,21 +199,21 @@ export const queueAuditEvent = async ({
* @param targetType - The type of target (e.g., "segment", "survey").
* @param handler - The handler function to wrap. It can be used with both authenticated and unauthenticated actions.
**/
export const withAuditLogging = <TParsedInput = Record<string, unknown>>(
export const withAuditLogging = <TParsedInput = Record<string, unknown>, TResult = unknown>(
action: TAuditAction,
targetType: TAuditTarget,
handler: (args: {
ctx: ActionClientCtx | AuthenticatedActionClientCtx;
parsedInput: TParsedInput;
}) => Promise<unknown>
}) => Promise<TResult>
) => {
return async function wrappedAction(args: {
ctx: ActionClientCtx | AuthenticatedActionClientCtx;
parsedInput: TParsedInput;
}) {
}): Promise<TResult> {
const { ctx, parsedInput } = args;
const { auditLoggingCtx } = ctx;
let result: any;
let result!: TResult;
let status: TAuditStatus = "success";
let error: any = undefined;