Files
myeasycms-v2/apps/dev-tool/components/env-mode-selector.tsx
Giancarlo Buomprisco 131b1061e6 Enforce RLS when user opted in to MFA. (#188)
* Allow Super Admin to view tables using RLS
* Replace previous usages of the Admin client using the authed client using the new RLS
* Enforce MFA for Super Admin users
* Enforce RLS when user opted in to MFA.
* Add Super Admin Access Policies and Update Database Types
* Consolidate super admin logic into a single function that uses the RPC is_super_admin
* Added Super Admin E2E tests
* Fixes and improvements
* Bump version to 2.5.0
2025-03-02 11:21:01 +08:00

46 lines
1.0 KiB
TypeScript

'use client';
import { useRouter } from 'next/navigation';
import { EnvMode } from '@/app/variables/lib/types';
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@kit/ui/select';
export function EnvModeSelector({ mode }: { mode: EnvMode }) {
const router = useRouter();
const handleModeChange = (value: EnvMode) => {
const searchParams = new URLSearchParams(window.location.search);
const path = window.location.pathname;
searchParams.set('mode', value);
router.push(`${path}?${searchParams.toString()}`);
};
return (
<div>
<Select
name={'mode'}
defaultValue={mode}
onValueChange={handleModeChange}
>
<SelectTrigger>
<SelectValue placeholder="Select Mode" />
</SelectTrigger>
<SelectContent>
<SelectItem value="development">Development</SelectItem>
<SelectItem value="production">Production</SelectItem>
</SelectContent>
</Select>
</div>
);
}