Skip to content

Commit

Permalink
internal dashboard- send approved and reminder emails based on the qu…
Browse files Browse the repository at this point in the history
…ery params
  • Loading branch information
arthtyagi committed Jan 20, 2023
1 parent 30ee794 commit bec402e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
39 changes: 26 additions & 13 deletions apps/web/src/app/internal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,25 @@ export default function Internal() {
}
};

const handleBulkMail = async (type: EmailType) => {
if (data !== null) {
const users = data?.data;
for (const user of users) {
if (type === 'reminder') {
handleMail(user.first_name, user.email, type);
} else {
handleMail(
user.first_name,
user.email,
type,
user.id,
queryParams.get('status') === 'True' ? 'False' : 'True'
);
}
}
}
};

interface ManagedUser {
id: number;
email: string;
Expand Down Expand Up @@ -100,21 +119,15 @@ export default function Internal() {
</p>
<div className="mt-6">
<PrimaryButton
onClick={() => {
handleMail(
'',
'',
'approved',
0,
queryParams.get('status') === 'True'
? 'False'
: 'True'
);
}}
onClick={() =>
queryParams.get('status') === 'True'
? handleBulkMail('approved')
: handleBulkMail('reminder')
}
>
{queryParams.get('status') === 'True'
? 'Send Unapproved Emails'
: 'Send Approved Emails'}
? 'Send Approved Emails'
: 'Send Reminder Emails'}
</PrimaryButton>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/stream/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Channel, DefaultGenerics } from 'stream-chat';
import type { Channel, DefaultGenerics } from 'stream-chat';

export type LtOrGtType = 'id_lte' | 'id_gte' | undefined;

Expand Down

1 comment on commit bec402e

@vercel
Copy link

@vercel vercel bot commented on bec402e Jan 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.