This commit is contained in:
giancarlo
2024-03-24 02:23:22 +08:00
parent 648d77b430
commit bce3479368
589 changed files with 37067 additions and 9596 deletions

View File

@@ -0,0 +1,32 @@
import { use } from 'react';
import getSupabaseServerComponentClient from '@packages/supabase/server-component-client';
import AdminGuard from '../../../../../../packages/admin/components/AdminGuard';
import BanUserModal from '../components/BanUserModal';
interface Params {
params: {
uid: string;
};
}
function BanUserModalPage({ params }: Params) {
const client = getSupabaseServerComponentClient({ admin: true });
const { data, error } = use(client.auth.admin.getUserById(params.uid));
if (!data || error) {
throw new Error(`User not found`);
}
const user = data.user;
const isBanned = 'banned_until' in user && user.banned_until !== 'none';
if (isBanned) {
throw new Error(`The user is already banned`);
}
return <BanUserModal user={user} />;
}
export default AdminGuard(BanUserModalPage);