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:
giancarlo
2024-04-18 20:21:21 +08:00
parent 903733ad60
commit 5ed3b18a00
2 changed files with 5 additions and 7 deletions

View File

@@ -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} />;
}

View File

@@ -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');
}
}