website refactor
This commit is contained in:
@@ -15,31 +15,29 @@ import { revalidatePath } from 'next/cache';
|
||||
/**
|
||||
* Update user status
|
||||
*/
|
||||
export async function updateUserStatus(userId: string, status: string): Promise<void> {
|
||||
try {
|
||||
const mutation = new UpdateUserStatusMutation();
|
||||
await mutation.execute({ userId, status });
|
||||
|
||||
// Revalidate the users page
|
||||
revalidatePath('/admin/users');
|
||||
} catch (error) {
|
||||
console.error('updateUserStatus failed:', error);
|
||||
export async function updateUserStatus(userId: string, status: string) {
|
||||
const mutation = new UpdateUserStatusMutation();
|
||||
const result = await mutation.execute({ userId, status });
|
||||
|
||||
if (result.isErr()) {
|
||||
console.error('updateUserStatus failed:', result.getError());
|
||||
throw new Error('Failed to update user status');
|
||||
}
|
||||
|
||||
revalidatePath('/admin/users');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
*/
|
||||
export async function deleteUser(userId: string): Promise<void> {
|
||||
try {
|
||||
const mutation = new DeleteUserMutation();
|
||||
await mutation.execute({ userId });
|
||||
|
||||
// Revalidate the users page
|
||||
revalidatePath('/admin/users');
|
||||
} catch (error) {
|
||||
console.error('deleteUser failed:', error);
|
||||
export async function deleteUser(userId: string) {
|
||||
const mutation = new DeleteUserMutation();
|
||||
const result = await mutation.execute({ userId });
|
||||
|
||||
if (result.isErr()) {
|
||||
console.error('deleteUser failed:', result.getError());
|
||||
throw new Error('Failed to delete user');
|
||||
}
|
||||
|
||||
revalidatePath('/admin/users');
|
||||
}
|
||||
Reference in New Issue
Block a user