Skip to content

Commit

Permalink
[front] - fix: correct payload key and implement error logging in Cre…
Browse files Browse the repository at this point in the history
…ateVaultModal

- Replace `memberIds` with `members` in the payload for vault creation to match expected API schema
- Add error logging with workspace context upon failing to create a vault to facilitate debugging
  • Loading branch information
Jules authored and Jules committed Aug 12, 2024
1 parent 52e3566 commit c427073
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions front/components/vaults/CreateVaultModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { MinusIcon } from "lucide-react";
import React, { useCallback, useContext, useMemo, useState } from "react";

import { SendNotificationsContext } from "@app/components/sparkle/Notification";
import logger from "@app/logger/logger";

type RowData = {
icon: string;
Expand Down Expand Up @@ -112,7 +113,7 @@ export function CreateVaultModal({
},
body: JSON.stringify({
name: vaultName,
memberIds: selectedMembers,
members: selectedMembers,
}),
});

Expand All @@ -128,10 +129,7 @@ export function CreateVaultModal({
}
};

const rows = useMemo(
() => getTableRows(allUsers),
[allUsers]
);
const rows = useMemo(() => getTableRows(allUsers), [allUsers]);

const columns = useMemo(
() => getTableColumns(selectedMembers, handleMemberToggle),
Expand All @@ -155,7 +153,14 @@ export function CreateVaultModal({
title: "Successfully created vault",
description: "Vault was successfully created.",
});
} catch (e) {
} catch (err) {
logger.error(
{
workspaceId: owner.id,
error: err,
},
"Error creating vault"
);
sendNotification({
type: "error",
title: "Failed to create vault",
Expand Down

0 comments on commit c427073

Please sign in to comment.