Refactor admin account page and email resend logic
The changes include breaking out `is_personal_account` into its own constant for better readability in the Admin Account page. On the email resend logic, the code has been simplified, directly throwing an error when the response is not OK, thereby eliminating unnecessary conditional and assignment statements.
This commit is contained in:
@@ -34,7 +34,9 @@ type Membership = Db['accounts_memberships']['Row'];
|
||||
export function AdminAccountPage(props: {
|
||||
account: Account & { memberships: Membership[] };
|
||||
}) {
|
||||
if (props.account.is_personal_account) {
|
||||
const isPersonalAccount = props.account.is_personal_account;
|
||||
|
||||
if (isPersonalAccount) {
|
||||
return <PersonalAccountPage account={props.account} />;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,12 +43,8 @@ export class ResendMailer implements Mailer {
|
||||
}),
|
||||
});
|
||||
|
||||
if (res.ok) {
|
||||
const data = await res.json();
|
||||
|
||||
return data;
|
||||
if (!res.ok) {
|
||||
throw new Error('Failed to send email');
|
||||
}
|
||||
|
||||
throw new Error('Failed to send email');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user