Add account deletion process and improve tests

The commit introduces a message to indicate the account deletion process. It also enhances the tests by reducing code redundancy in the e2e tests, creating a more random name for team accounts, and improving the navigation process after account deletions. The commit also includes code cleanup tasks, such as the removal of unused imports.
This commit is contained in:
giancarlo
2024-04-12 21:30:13 +08:00
parent 2bad506d75
commit 21fba33462
6 changed files with 13 additions and 21 deletions

View File

@@ -142,7 +142,11 @@ function DeleteAccountSubmitButton() {
name={'action'}
variant={'destructive'}
>
<Trans i18nKey={'account:deleteAccount'} />
{pending ? (
<Trans i18nKey={'account:deletingAccount'} />
) : (
<Trans i18nKey={'account:deleteAccount'} />
)}
</Button>
);
}

View File

@@ -1,7 +1,7 @@
'use server';
import { revalidatePath } from 'next/cache';
import { RedirectType, redirect } from 'next/navigation';
import { redirect } from 'next/navigation';
import { z } from 'zod';
@@ -66,10 +66,11 @@ export async function deletePersonalAccountAction(formData: FormData) {
// sign out the user after deleting their account
await client.auth.signOut();
// clear the cache for all pages
revalidatePath('/', 'layout');
// redirect to the home page
redirect('/', RedirectType.replace);
redirect('/');
}
function getEmailSettingsFromEnvironment() {