Skip to content

Commit

Permalink
Ran npm prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
Rahuldeb5 committed Oct 6, 2024
1 parent 56915c1 commit cb9c69a
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/pages/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ const Settings = () => {

if (membershipsData && membershipsData.length > 0) {
const membershipIds = membershipsData.map((m) => m.id);
const organizationIds = membershipsData.map((m) => m.organization_id);
const organizationIds = membershipsData.map(
(m) => m.organization_id,
);

const { data: notificationsData, error: notificationsError } = await supabase
.from("membershipnotifications")
.select("membership_id, allow_notifications")
.in("membership_id", membershipIds);
const { data: notificationsData, error: notificationsError } =
await supabase
.from("membershipnotifications")
.select("membership_id, allow_notifications")
.in("membership_id", membershipIds);

if (notificationsError) {
enqueueSnackbar("Failed to fetch notification settings", {
Expand All @@ -62,16 +65,20 @@ const Settings = () => {

const mergedData = membershipsData.map((membership) => {
const notification = notificationsData.find(
(n) => n.membership_id === membership.id
(n) => n.membership_id === membership.id,
);
const organization = organizationsData.find(
(org) => org.id === membership.organization_id
(org) => org.id === membership.organization_id,
);

return {
...membership,
allow_notifications: notification ? notification.allow_notifications : true,
organization_name: organization ? organization.name : "Unknown",
allow_notifications: notification
? notification.allow_notifications
: true,
organization_name: organization
? organization.name
: "Unknown",
};
});

Expand Down

0 comments on commit cb9c69a

Please sign in to comment.