mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-20 02:30:18 -05:00
API key check
This commit is contained in:
@@ -25,6 +25,6 @@ export default async function ApiKeyList({
|
||||
const apiKeys = await getApiKeys(environmentTypeId);
|
||||
|
||||
return (
|
||||
<EditApiKeys environmentTypeId={environmentTypeId} environmentType={environmentType} apiKeys={apiKeys} />
|
||||
<EditApiKeys environmentTypeId={environmentTypeId} environmentType={environmentType} apiKeys={apiKeys} environmentId={environmentId}/>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,10 +15,12 @@ export default function EditAPIKeys({
|
||||
environmentTypeId,
|
||||
environmentType,
|
||||
apiKeys,
|
||||
environmentId
|
||||
}: {
|
||||
environmentTypeId: string;
|
||||
environmentType: string;
|
||||
apiKeys: TApiKey[];
|
||||
environmentId: string
|
||||
}) {
|
||||
const [isAddAPIKeyModalOpen, setOpenAddAPIKeyModal] = useState(false);
|
||||
const [isDeleteKeyModalOpen, setOpenDeleteKeyModal] = useState(false);
|
||||
@@ -52,6 +54,7 @@ export default function EditAPIKeys({
|
||||
<div className="mb-6 text-right">
|
||||
<Button
|
||||
variant="darkCTA"
|
||||
disabled={environmentId!==environmentTypeId}
|
||||
onClick={() => {
|
||||
setOpenAddAPIKeyModal(true);
|
||||
}}>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { REVALIDATION_INTERVAL } from "@formbricks/lib/constants";
|
||||
import SettingsCard from "../SettingsCard";
|
||||
import SettingsTitle from "../SettingsTitle";
|
||||
import ApiKeyList from "./ApiKeyList";
|
||||
import EnvironmentNotice from "@/app/(app)/environments/[environmentId]/settings/setup/EnvironmentNotice";
|
||||
|
||||
export default async function ProfileSettingsPage({ params }) {
|
||||
return (
|
||||
@@ -14,6 +15,7 @@ export default async function ProfileSettingsPage({ params }) {
|
||||
description="Add and remove API keys for your Development environment.">
|
||||
<ApiKeyList environmentId={params.environmentId} environmentType="development" />
|
||||
</SettingsCard>
|
||||
<EnvironmentNotice environmentId={params.environmentId} pageType="apiSettings"/>
|
||||
<SettingsCard
|
||||
title="Production Env Keys"
|
||||
description="Add and remove API keys for your Production environment.">
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ErrorComponent } from "@formbricks/ui";
|
||||
import { LightBulbIcon } from "@heroicons/react/24/solid";
|
||||
import { useRouter } from "next/navigation";
|
||||
|
||||
export default function EnvironmentNotice({ environmentId }: { environmentId: string }) {
|
||||
export default function EnvironmentNotice({ environmentId,pageType }: { environmentId: string, pageType:string }) {
|
||||
const { environment, isErrorEnvironment, isLoadingEnvironment } = useEnvironment(environmentId);
|
||||
const router = useRouter();
|
||||
|
||||
@@ -22,7 +22,18 @@ export default function EnvironmentNotice({ environmentId }: { environmentId: st
|
||||
if (isErrorEnvironment) {
|
||||
return <ErrorComponent />;
|
||||
}
|
||||
if(pageType==="apiSettings"){
|
||||
return (<div>
|
||||
<div className="flex items-center space-y-3 rounded-lg border border-blue-100 bg-blue-50 p-4 text-sm text-blue-900 shadow-sm md:space-y-0 md:text-base">
|
||||
<LightBulbIcon className="mr-3 h-8 w-8 text-blue-400" />
|
||||
<p>
|
||||
Production environment API keys can exclusively be generated and utilized within the production environment, and similarly, development API keys follow the same pattern.
|
||||
</p>
|
||||
</div>
|
||||
</div>)
|
||||
}
|
||||
|
||||
if(pageType==="setupChecklist")
|
||||
return (
|
||||
<div>
|
||||
{environment.type === "production" && !environment.widgetSetupCompleted && (
|
||||
|
||||
@@ -12,7 +12,7 @@ export default function ProfileSettingsPage({ params }) {
|
||||
<WidgetStatusIndicator environmentId={params.environmentId} type="large" />
|
||||
</SettingsCard>
|
||||
|
||||
<EnvironmentNotice environmentId={params.environmentId} />
|
||||
<EnvironmentNotice environmentId={params.environmentId} pageType="setupChecklist"/>
|
||||
<SettingsCard
|
||||
title="How to setup"
|
||||
description="Follow these steps to setup the Formbricks widget within your app"
|
||||
|
||||
Reference in New Issue
Block a user