Remove use-toast.tsx, refactor auth methods, and update UI components
This commit removes the redundant `use-toast.tsx` file and refactors the authentication methods in `personal-accounts-server-actions.ts` to enhance service integration and data handling. UI components like `LanguageDropdownSwitcher` and `site-header-account-section.tsx` have been refined for better readability. Changes in the `config.tsx` file aim to improve the overall code cleanliness. The `schema.sql` file under migrations was updated to cascade delete for 'invited_by' reference.
This commit is contained in:
@@ -33,9 +33,15 @@ export async function deletePersonalAccountAction(formData: FormData) {
|
||||
`Deleting personal account...`,
|
||||
);
|
||||
|
||||
const deleteAccountResponse = await service.deletePersonalAccount({
|
||||
userId,
|
||||
});
|
||||
const deleteAccountResponse = await service.deletePersonalAccount(
|
||||
getSupabaseServerActionClient({ admin: true }),
|
||||
{
|
||||
userId,
|
||||
},
|
||||
);
|
||||
|
||||
//
|
||||
// also delete any associated data and subscriptions
|
||||
|
||||
if (deleteAccountResponse.error) {
|
||||
Logger.error(
|
||||
|
||||
@@ -13,5 +13,10 @@ import { Database } from '@kit/supabase/database';
|
||||
export class PersonalAccountsService {
|
||||
constructor(private readonly client: SupabaseClient<Database>) {}
|
||||
|
||||
async deletePersonalAccount(param: { userId: string }) {}
|
||||
async deletePersonalAccount(
|
||||
adminClient: SupabaseClient<Database>,
|
||||
params: { userId: string },
|
||||
) {
|
||||
return adminClient.auth.admin.deleteUser(params.userId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user