Update admin action functionalities and UI
This commit includes several changes to the admin functionality. Most notably, it updates the actions deleteUser and banUser to deleteAccount and updates the UI for admin actions. It also includes new variants for badges, and adds new icons to buttons. In addition, it updates the user schemas to match these changes.
This commit is contained in:
@@ -28,6 +28,10 @@ export const banUser = enhanceAdminAction(
|
||||
await service.banUser(userId);
|
||||
|
||||
revalidateAdmin();
|
||||
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
},
|
||||
{
|
||||
schema: BanUserSchema,
|
||||
@@ -47,6 +51,10 @@ export const reactivateUser = enhanceAdminAction(
|
||||
await service.reactivateUser(userId);
|
||||
|
||||
revalidateAdmin();
|
||||
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
},
|
||||
{
|
||||
schema: ReactivateUserSchema,
|
||||
@@ -83,6 +91,10 @@ export const deleteUser = enhanceAdminAction(
|
||||
await service.deleteUser(userId);
|
||||
|
||||
revalidateAdmin();
|
||||
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
},
|
||||
{
|
||||
schema: DeleteUserSchema,
|
||||
@@ -102,6 +114,10 @@ export const deleteAccount = enhanceAdminAction(
|
||||
await service.deleteAccount(accountId);
|
||||
|
||||
revalidateAdmin();
|
||||
|
||||
return {
|
||||
success: true,
|
||||
};
|
||||
},
|
||||
{
|
||||
schema: DeleteAccountSchema,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
const confirmationSchema = z.object({
|
||||
confirmation: z.custom((value) => value === 'CONFIRM'),
|
||||
const ConfirmationSchema = z.object({
|
||||
confirmation: z.custom<string>((value) => value === 'CONFIRM'),
|
||||
});
|
||||
|
||||
const UserIdSchema = confirmationSchema.extend({
|
||||
const UserIdSchema = ConfirmationSchema.extend({
|
||||
userId: z.string().uuid(),
|
||||
});
|
||||
|
||||
@@ -13,6 +13,6 @@ export const ReactivateUserSchema = UserIdSchema;
|
||||
export const ImpersonateUserSchema = UserIdSchema;
|
||||
export const DeleteUserSchema = UserIdSchema;
|
||||
|
||||
export const DeleteAccountSchema = confirmationSchema.extend({
|
||||
export const DeleteAccountSchema = ConfirmationSchema.extend({
|
||||
accountId: z.string().uuid(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user