Move sign out command before account deletion and modify private path prefixes
The sign out command is moved ahead of the account deletion service to ensure users are logged out before their account gets deleted. The "/join" prefix is removed from the list of private path prefixes. Additionally, a global loader component is added to the join loading page.
This commit is contained in:
3
apps/web/app/join/loading.tsx
Normal file
3
apps/web/app/join/loading.tsx
Normal file
@@ -0,0 +1,3 @@
|
||||
import { GlobalLoader } from '@kit/ui/global-loader';
|
||||
|
||||
export default GlobalLoader;
|
||||
@@ -37,6 +37,9 @@ export const deletePersonalAccountAction = enhanceAction(
|
||||
// create a new instance of the personal accounts service
|
||||
const service = createDeletePersonalAccountService();
|
||||
|
||||
// sign out the user before deleting their account
|
||||
await client.auth.signOut();
|
||||
|
||||
// delete the user's account and cancel all subscriptions
|
||||
await service.deletePersonalAccount({
|
||||
adminClient: getSupabaseServerActionClient({ admin: true }),
|
||||
@@ -45,9 +48,6 @@ export const deletePersonalAccountAction = enhanceAction(
|
||||
emailSettings,
|
||||
});
|
||||
|
||||
// sign out the user after deleting their account
|
||||
await client.auth.signOut();
|
||||
|
||||
// clear the cache for all pages
|
||||
revalidatePath('/', 'layout');
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { useRevalidateUserSession, useUserSession } from './use-user-session';
|
||||
* @name PRIVATE_PATH_PREFIXES
|
||||
* @description A list of private path prefixes
|
||||
*/
|
||||
const PRIVATE_PATH_PREFIXES = ['/home', '/admin', '/join', '/update-password'];
|
||||
const PRIVATE_PATH_PREFIXES = ['/home', '/admin', '/update-password'];
|
||||
|
||||
/**
|
||||
* @name useAuthChangeListener
|
||||
|
||||
Reference in New Issue
Block a user