mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-07 00:40:10 -06:00
fix: types in audit log wrapper (#6200)
This commit is contained in:
@@ -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" />,
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user